UtiLite
0.3.1
A lite utilities library
|
#include <UMutex.h>
Public Member Functions | |
UMutex () | |
int | lock () const |
int | unlock () const |
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] |
The constructor.
int UMutex::lock | ( | ) | const [inline] |
Lock the mutex.
int UMutex::unlock | ( | ) | const [inline] |
Unlock the mutex.