SSystemMutex Struct Reference
[Threads]

Search Toolkit Book for SSystemMutex

#include <ncbimtx.hpp>

Collaboration diagram for SSystemMutex:

Collaboration graph
[legend]
List of all members.

Detailed Description

SSystemMutex --.

Define system mutex.

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

Definition at line 382 of file ncbimtx.hpp.

Public Member Functions

void Lock (void)
 Acquire mutex for the current thread.
void Unlock (void)
 Release mutex.
bool TryLock (void)
 Try to lock.

Static Public Member Functions

static void ThrowNotOwned (void)
 Throw not owned("eOwner") exception.

Public Attributes

SSystemFastMutex m_Mutex
 Mutex value.
volatile CThreadSystemID m_Owner
 Platform-dependent owner thread ID.
volatile int m_Count
 # of recursive (in the same thread) locks

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.

Friends

class CAutoInitializeStaticMutex
class CMutex


Member Function Documentation

void SSystemMutex::Destroy void   )  [protected]
 

Destroy mutex.

Definition at line 204 of file ncbimtx.cpp.

References SSystemFastMutex::Destroy(), m_Count, m_Mutex, and xncbi_Validate.

void SSystemMutex::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.

void SSystemMutex::InitializeStatic void   )  [protected]
 

Initialize static mutex.

Must be called only once.

bool SSystemMutex::IsInitialized void   )  const [protected]
 

Check if mutex is initialized.

Returns:
TRUE if initialized; FALSE, otherwise.

bool SSystemMutex::IsUninitialized void   )  const [protected]
 

Check if mutex is un-initialized.

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

void SSystemMutex::Lock void   ) 
 

Acquire mutex for the current thread.

Definition at line 295 of file ncbimtx.cpp.

References SSystemFastMutex::CheckInitialized(), CThreadSystemID::GetCurrent(), CThreadSystemID::Is(), m_Count, m_Mutex, and m_Owner.

void SSystemMutex::ThrowNotOwned void   )  [static]
 

Throw not owned("eOwner") exception.

Definition at line 358 of file ncbimtx.cpp.

References NCBI_THROW.

Referenced by Unlock().

bool SSystemMutex::TryLock void   ) 
 

Try to lock.

Returns:
TRUE on success; FALSE, otherwise.

Definition at line 313 of file ncbimtx.cpp.

References SSystemFastMutex::CheckInitialized(), CThreadSystemID::GetCurrent(), CThreadSystemID::Is(), m_Count, m_Mutex, and m_Owner.

void SSystemMutex::Unlock void   ) 
 

Release mutex.

Definition at line 336 of file ncbimtx.cpp.

References SSystemFastMutex::CheckInitialized(), CThreadSystemID::GetCurrent(), CThreadSystemID::IsNot(), m_Count, m_Mutex, m_Owner, and ThrowNotOwned().


Friends And Related Function Documentation

friend class CAutoInitializeStaticMutex [friend]
 

Definition at line 443 of file ncbimtx.hpp.

friend class CMutex [friend]
 

Definition at line 444 of file ncbimtx.hpp.


Member Data Documentation

volatile int SSystemMutex::m_Count
 

# of recursive (in the same thread) locks

Definition at line 388 of file ncbimtx.hpp.

Referenced by Destroy(), Lock(), TryLock(), and Unlock().

SSystemFastMutex SSystemMutex::m_Mutex
 

Mutex value.

Definition at line 384 of file ncbimtx.hpp.

Referenced by Destroy(), Lock(), TryLock(), and Unlock().

volatile CThreadSystemID SSystemMutex::m_Owner
 

Platform-dependent owner thread ID.

Definition at line 386 of file ncbimtx.hpp.

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


The documentation for this struct was generated from the following files:
Generated on Mon Dec 7 15:56:29 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