Recursive mutex class. More...
#include <tinythread.h>
Public Member Functions | |
recursive_mutex () | |
Constructor. | |
~recursive_mutex () | |
Destructor. | |
void | lock () |
Lock the mutex. | |
bool | try_lock () |
Try to lock the mutex. | |
void | unlock () |
Unlock the mutex. |
Recursive mutex class.
This is a mutual exclusion object for synchronizing access to shared memory areas for several threads. The mutex is recursive (i.e. a thread may lock the mutex several times, as long as it unlocks the mutex the same number of times).
void lock | ( | ) | [inline] |
Lock the mutex.
The method will block the calling thread until a lock on the mutex can be obtained. The mutex remains locked until unlock()
is called.
bool try_lock | ( | ) | [inline] |
Try to lock the mutex.
The method will try to lock the mutex. If it fails, the function will return immediately (non-blocking).
true
if the lock was acquired, or false
if the lock could not be acquired. void unlock | ( | ) | [inline] |
Unlock the mutex.
If any threads are waiting for the lock on this mutex, one of them will be unblocked.