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.

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


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.


The documentation for this class was generated from the following files:
Generated on Tue Sep 20 20:21:53 2005 for CPLAT_MacOS by  doxygen 1.4.0