#include <OnixS/CME/ConflatedTCP/threading/Mutex.h>
Public Member Functions | |
Mutex () | |
~Mutex () | |
void | acquire () |
bool | tryAcquire () |
void | release () |
Friends | |
class | Condition |
Protects resources from simultaneous access by multiple threads.
Only one thread at a time can own instance of this class.
This implementation is optimized for locking threads that are in the same process.
Mutex | ( | ) |
Initializes the instance.
~Mutex | ( | ) |
Destructs the instance.
void acquire | ( | ) |
Acquires the lock ownership.
If the mutex is already occupied by another thread blocks the current thread and waits until it will be released by the owner.
void release | ( | ) |
Releases the ownership (lock) and unblocks one of the waiting threads.
bool tryAcquire | ( | ) |
Tries to acquires the lock ownership.
false
if the mutex is already occupied by another thread, otherwise - true
.