#include <UMutex.h>
Public Member Functions | |
int | lock () const |
int | lockTry () const |
UMutex () | |
int | unlock () const |
virtual | ~UMutex () |
Private Member Functions | |
void | operator= (UMutex &M) |
UMutex (const UMutex &M) | |
Private Attributes | |
pthread_mutex_t | M |
A mutex class.
On a lock() call, the calling thread is blocked if the UMutex was previously locked by another thread. It is unblocked when unlock() is called.
On Unix (not yet tested on Windows), UMutex is recursive: the same thread can call multiple times lock() without being blocked.
Example:
UMutex m; // Mutex shared with another thread(s). ... m.lock(); // Data is protected here from the second thread //(assuming the second one protects also with the same mutex the same data). m.unlock();
UMutex::UMutex | ( | ) | [inline] |
virtual UMutex::~UMutex | ( | ) | [inline, virtual] |
UMutex::UMutex | ( | const UMutex & | M | ) | [inline, private] |
int UMutex::lock | ( | ) | const [inline] |
int UMutex::lockTry | ( | ) | const [inline] |
int UMutex::unlock | ( | ) | const [inline] |