Main Page | Class Hierarchy | Class List | File List | Class Members

Mutex Class Reference

#include <Mutex.h>

List of all members.

Public Member Functions

 Mutex (GlobalData *globalData)
virtual ~Mutex ()
bool iHoldIt () const
void acquire ()
void release ()


Detailed Description

The Mutex class implements a mutex object that allows threads to acquire the mutex several times (sometimes called a recursive mutex).


Constructor & Destructor Documentation

Mutex::Mutex GlobalData globalData  )  [inline]
 

Mutex constructor.

Parameters:
globalData a pointer to the synchronization object; best if globalData really is a pointer to a global object.

virtual Mutex::~Mutex  )  [inline, virtual]
 

Destroy the mutex, releasing it if still held.


Member Function Documentation

void Mutex::acquire  )  [inline]
 

Acquire the mutex for the current thread, or just increment its internal counter if the current thread already holds the mutex. If some other thread currently holds the mutex, the current thread will block until the mutex is fully released by its current holder.

bool Mutex::iHoldIt  )  const [inline]
 

Return `true' if the current thread acquired the mutex.

void Mutex::release  )  [inline]
 

Release the mutex. This should only be called by the thread that actually holds the mutex. Attempts to do otherwise will most likely fuck up your synchronization logic. To be fully released, a mutex must be released a number of times equal to the number of times it has been acquired. All in the same thread, of course.


The documentation for this class was generated from the following file:
Generated on Wed May 25 12:21:20 2005 for csp.kdevelop by  doxygen 1.3.9.1