Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CP_Mutex Class Reference

Mutex use with preemptive threading. More...

Inheritance diagram for CP_Mutex:

CP_NoCopy List of all members.

Public Member Functions

 CP_Mutex ()
 Allocate the OS mutex resource.
 ~CP_Mutex ()
 Deallocate the OS mutex resource.
void lock ()
 Lock the mutex.
void unlock ()
 Unlock the mutex.

Private Types

typedef CRITICAL_SECTION mutex_type

Private Attributes

mutex_type fMutex_
 the OS mutex resource

Detailed Description

Mutex class that abstracts away different underlying threading APIs and allows a common access to thread synchronization.
For preemptive threading implementations, the mutex will use the underlying threading APIs to setup, lock and unlock mutices, whereas for cooperative threading implementations, the mutices will do nothing when locked / unlocked, assuming that there is no concurrent execution happening anyway.

See also:
CP_M_Thread


Member Typedef Documentation

typedef CRITICAL_SECTION CP_Mutex::mutex_type [private]
 


Constructor & Destructor Documentation

CPLAT_Begin_Namespace_CPLAT CP_Mutex::CP_Mutex  ) 
 

Exceptions:
std::runtime_error raised if mutex resource could not be allocated.

CP_Mutex::~CP_Mutex  ) 
 

Exceptions:
none. 


Member Function Documentation

void CP_Mutex::lock  ) 
 

Attempts to lock the mutex, blocking until the lock operation succeeded.

Exceptions:
std::runtime_error raised if lock could not be acquired.

void CP_Mutex::unlock  ) 
 

Unlocks a previously locked mutex. When calling unlock for an unlocked mutex, the behavior is not specified.

Exceptions:
std::runtime_error raised if unlock failed.


Member Data Documentation

mutex_type CP_Mutex::fMutex_ [private]
 


The documentation for this class was generated from the following files:
Generated on Sat Sep 17 20:01:53 2005 for CPLAT by  doxygen 1.4.0