Mutual exclusion device. More...
|Default constructor. |
|Lock the mutex. More...|
|Tries to lock the mutex. More...|
|Unlocks the mutex. |
|Unlocks the mutex. More...|
A Mutex is a mutual exclusion device. It is used to synchronize the access to data which is accessed by more than one thread or process at the same time. Mutexes are not recursive, that is the same thread can not lock a mutex multiple times without deadlocking.
The destructor destroys the mutex. The mutex must be in unlocked state when the destructor is called.
If the mutex is currently locked by another thread, the calling thread suspends until no other thread holds a lock on it. If the mutex is already locked by the calling thread a deadlock occurs.
If the mutex is currently locked by another thread, false is returned, otherwise the lock is acquired.
This method does not throw an exception if unlocking the mutex fails but simply returns false.