SSystemFastMutex Struct Reference
[Threads]

Search Toolkit Book for SSystemFastMutex

#include <ncbimtx.hpp>

Inheritance diagram for SSystemFastMutex:

Inheritance graph
[legend]
List of all members.

Detailed Description

SSystemFastMutex --.

Define system fast mutex.

Internal platform-dependent fast mutex implementation to be used by CMutex and CFastMutex only.

Definition at line 260 of file ncbimtx.hpp.

Public Types

enum  EMagic { eMutexUninitialized = 0, eMutexInitialized = 0x2487adab }
 Initialization flag values. More...

Public Member Functions

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 to lock.
void CheckInitialized (void) const
 Check initialized value of mutex.

Static Public Member Functions

static void ThrowUninitialized (void)
 Throw uninitialized ("eUninitialized") exception.
static void ThrowLockFailed (void)
 Throw lock failed("eLocked") exception.
static void ThrowUnlockFailed (void)
 Throw unlock failed("eUnlocked") exception.
static void ThrowTryLockFailed (void)
 Throw try lock failed("eTryLock") exception.

Public Attributes

TSystemMutex m_Handle
 Mutex handle.
volatile EMagic m_Magic
 Magic flag.

Protected Member Functions

bool IsInitialized (void) const
 Check if mutex is initialized.
bool IsUninitialized (void) const
 Check if mutex is un-initialized.
void InitializeStatic (void)
 Initialize static mutex.
void InitializeDynamic (void)
 Initialize dynamic mutex.
void Destroy (void)
 Destroy mutex.
void InitializeHandle (void)
 Initialize mutex handle.
void DestroyHandle (void)
 Destroy mutex handle.

Friends

struct SSystemMutex
class CAutoInitializeStaticFastMutex
class CFastMutex
class CSafeStaticPtr_Base


Member Enumeration Documentation

enum SSystemFastMutex::EMagic
 

Initialization flag values.

Enumerator:
eMutexUninitialized  Uninitialized value.
eMutexInitialized  Magic initialized value,.

Definition at line 265 of file ncbimtx.hpp.


Member Function Documentation

void SSystemFastMutex::CheckInitialized void   )  const
 

Check initialized value of mutex.

Referenced by SSystemMutex::Lock(), Lock(), SSystemMutex::TryLock(), TryLock(), SSystemMutex::Unlock(), and Unlock().

void SSystemFastMutex::Destroy void   )  [protected]
 

Destroy mutex.

Definition at line 172 of file ncbimtx.cpp.

References DestroyHandle(), eMutexUninitialized, IsInitialized(), m_Magic, and xncbi_Validate.

Referenced by SSystemMutex::Destroy().

void SSystemFastMutex::DestroyHandle void   )  [protected]
 

Destroy mutex handle.

Must be called only once.

Definition at line 125 of file ncbimtx.cpp.

References m_Handle, WRITE_MUTEX_EVENT, and xncbi_Verify.

Referenced by Destroy().

void SSystemFastMutex::InitializeDynamic void   )  [protected]
 

Initialize dynamic mutex.

Initialize mutex if it located in heap or stack. This must be called only once. Do not count on zeroed memory values for initializing mutex values.

Definition at line 162 of file ncbimtx.cpp.

References eMutexInitialized, InitializeHandle(), and m_Magic.

void SSystemFastMutex::InitializeHandle void   )  [protected]
 

Initialize mutex handle.

Must be called only once.

Definition at line 96 of file ncbimtx.cpp.

References FALSE, m_Handle, WRITE_MUTEX_EVENT, and xncbi_Validate.

Referenced by InitializeDynamic(), and InitializeStatic().

void SSystemFastMutex::InitializeStatic void   )  [protected]
 

Initialize static mutex.

Must be called only once.

Definition at line 141 of file ncbimtx.cpp.

References eMutexInitialized, eMutexUninitialized, InitializeHandle(), m_Magic, and xncbi_Validate.

bool SSystemFastMutex::IsInitialized void   )  const [protected]
 

Check if mutex is initialized.

Returns:
TRUE if initialized; FALSE, otherwise.

Referenced by Destroy().

bool SSystemFastMutex::IsUninitialized void   )  const [protected]
 

Check if mutex is un-initialized.

Returns:
TRUE if un-initialized; FALSE, otherwise.

void SSystemFastMutex::Lock void   ) 
 

Acquire mutex for the current thread with no nesting checks.

Definition at line 211 of file ncbimtx.cpp.

References CheckInitialized(), m_Handle, ThrowLockFailed(), and WRITE_MUTEX_EVENT.

void SSystemFastMutex::ThrowLockFailed void   )  [static]
 

Throw lock failed("eLocked") exception.

Definition at line 188 of file ncbimtx.cpp.

References NCBI_THROW.

Referenced by Lock().

void SSystemFastMutex::ThrowTryLockFailed void   )  [static]
 

Throw try lock failed("eTryLock") exception.

Definition at line 198 of file ncbimtx.cpp.

References NCBI_THROW.

Referenced by TryLock().

void SSystemFastMutex::ThrowUninitialized void   )  [static]
 

Throw uninitialized ("eUninitialized") exception.

Definition at line 183 of file ncbimtx.cpp.

References eUninitialized, and NCBI_THROW.

void SSystemFastMutex::ThrowUnlockFailed void   )  [static]
 

Throw unlock failed("eUnlocked") exception.

Definition at line 193 of file ncbimtx.cpp.

References NCBI_THROW.

Referenced by Unlock().

bool SSystemFastMutex::TryLock void   ) 
 

Try to lock.

Returns:
TRUE on success; FALSE, otherwise.

Definition at line 234 of file ncbimtx.cpp.

References CheckInitialized(), m_Handle, ThrowTryLockFailed(), and WRITE_MUTEX_EVENT.

void SSystemFastMutex::Unlock void   ) 
 

Release mutex with no owner or nesting checks.

Definition at line 272 of file ncbimtx.cpp.

References CheckInitialized(), m_Handle, ThrowUnlockFailed(), and WRITE_MUTEX_EVENT.


Friends And Related Function Documentation

friend class CAutoInitializeStaticFastMutex [friend]
 

Definition at line 355 of file ncbimtx.hpp.

friend class CFastMutex [friend]
 

Definition at line 357 of file ncbimtx.hpp.

friend class CSafeStaticPtr_Base [friend]
 

Definition at line 359 of file ncbimtx.hpp.

friend struct SSystemMutex [friend]
 

Definition at line 354 of file ncbimtx.hpp.


Member Data Documentation

TSystemMutex SSystemFastMutex::m_Handle
 

Mutex handle.

Definition at line 262 of file ncbimtx.hpp.

Referenced by DestroyHandle(), InitializeHandle(), Lock(), TryLock(), and Unlock().

volatile EMagic SSystemFastMutex::m_Magic
 

Magic flag.

Definition at line 269 of file ncbimtx.hpp.

Referenced by Destroy(), InitializeDynamic(), and InitializeStatic().


The documentation for this struct was generated from the following files:
Generated on Mon Dec 7 15:56:28 2009 for NCBI C++ ToolKit by  doxygen 1.4.6
Modified on Mon Dec 07 16:24:33 2009 by modify_doxy.py rev. 173732