A cross-platform abstraction of the OS's mutex. More...
#include <mutex.h>
Public Member Functions | |
Mutex () | |
Constructor, creates an unlocked mutex. | |
~Mutex () | |
Destructor. | |
void | Lock () |
Lock the mutex. More... | |
void | lock () |
Simply calls Lock() for compatibility with lock_guard and other more standard mutexes. | |
bool | TryLock () |
Try to lock the mutex. More... | |
void | Unlock () |
Unlock the mutex. More... | |
void | unlock () |
Simply calls Unlock() for compatibility with lock_guard and other more standard mutexes. | |
A cross-platform abstraction of the OS's mutex.
Use this for potentially long delays, like making multiple system calls. This is likely slower than a spinlock, but it informs the OS of delay and could allow another thread to be scheduled, making use of the time the current thread would otherwise spin.
void Mezzanine::Threading::Mutex::Lock | ( | ) |
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 Mezzanine::Threading::Mutex::TryLock | ( | ) |
void Mezzanine::Threading::Mutex::Unlock | ( | ) |