CFastMutex Class Reference
[Threads]

Search Toolkit Book for CFastMutex

#include <ncbimtx.hpp>

Collaboration diagram for CFastMutex:

Collaboration graph
[legend]
List of all members.

Detailed Description

CFastMutex --.

Simple mutex with fast lock/unlock functions.

This mutex can be used instead of CMutex if it's guaranteed that there is no nesting. This mutex does not check nesting or owner. It has better performance than CMutex, but is less secure.

Definition at line 633 of file ncbimtx.hpp.

Public Types

typedef CFastMutexGuard TReadLockGuard
 Define Read Lock Guard.
typedef CFastMutexGuard TWriteLockGuard
 Define Write Lock Guard.

Public Member Functions

 CFastMutex (void)
 Constructor.
 ~CFastMutex (void)
 Destructor.
void Lock (void)
 Acquire mutex for the current thread with no nesting checks.
void Unlock (void)
 Release mutex with no owner or nesting checks.
bool TryLock (void)
 Try locking the mutex.
 operator SSystemFastMutex & (void)
 Get SSystemFastMutex.

Private Member Functions

TSystemMutex * GetHandle (void)
 Get handle - Unix version.
 CFastMutex (const CFastMutex &)
 Private copy constructor to disallow initialization.
CFastMutexoperator= (const CFastMutex &)
 Private assignment operator to disallow assignment.

Private Attributes

SSystemFastMutex m_Mutex
 Platform-dependent mutex handle, also used by CRWLock.

Friends

class CRWLock


Member Typedef Documentation

typedef CFastMutexGuard CFastMutex::TReadLockGuard
 

Define Read Lock Guard.

Definition at line 647 of file ncbimtx.hpp.

typedef CFastMutexGuard CFastMutex::TWriteLockGuard
 

Define Write Lock Guard.

Definition at line 650 of file ncbimtx.hpp.


Constructor & Destructor Documentation

CFastMutex::CFastMutex void   ) 
 

Constructor.

Creates mutex handle.

CFastMutex::~CFastMutex void   ) 
 

Destructor.

Close mutex handle. No checks if it's still acquired.

CFastMutex::CFastMutex const CFastMutex  )  [private]
 

Private copy constructor to disallow initialization.


Member Function Documentation

TSystemMutex* CFastMutex::GetHandle void   )  [inline, private]
 

Get handle - Unix version.

Also used by CRWLock.

Definition at line 669 of file ncbimtx.hpp.

void CFastMutex::Lock void   ) 
 

Acquire mutex for the current thread with no nesting checks.

Referenced by BlastLockHandler(), CWorkerNodeAffinityGuard::CWorkerNodeAffinityGuard(), CQueueGuard::Guard(), CBDB_Cache::Lock(), and CFastRWLock::WriteLock().

CFastMutex::operator SSystemFastMutex & void   ) 
 

Get SSystemFastMutex.

CFastMutex& CFastMutex::operator= const CFastMutex  )  [private]
 

Private assignment operator to disallow assignment.

bool CFastMutex::TryLock void   ) 
 

Try locking the mutex.

void CFastMutex::Unlock void   ) 
 

Release mutex with no owner or nesting checks.

Referenced by BlastLockHandler(), CQueueGuard::Release(), CBDB_Cache::Unlock(), and CWorkerNodeAffinityGuard::~CWorkerNodeAffinityGuard().


Friends And Related Function Documentation

friend class CRWLock [friend]
 

Definition at line 677 of file ncbimtx.hpp.


Member Data Documentation

SSystemFastMutex CFastMutex::m_Mutex [private]
 

Platform-dependent mutex handle, also used by CRWLock.

Definition at line 680 of file ncbimtx.hpp.


The documentation for this class was generated from the following file:
Generated on Mon Dec 7 11:33:09 2009 for NCBI C++ ToolKit by  doxygen 1.4.6
Modified on Mon Dec 07 16:23:05 2009 by modify_doxy.py rev. 173732