QuantumLibrary
|
Coroutine-compatible implementation of a mutex. More...
#include <quantum_mutex.h>
Classes | |
class | Guard |
class | ReverseGuard |
Public Member Functions | |
Mutex () | |
Default constructor. More... | |
Mutex (const Mutex &other)=delete | |
Mutex & | operator= (const Mutex &other)=delete |
void | lock () |
Locks this mutex. More... | |
void | lock (ICoroSync::Ptr sync) |
Locks this mutex. More... | |
bool | tryLock () |
Tries to lock the mutex object. More... | |
void | unlock () |
Unlock this mutex. More... | |
Coroutine-compatible implementation of a mutex.
This mutex wraps a specialized form of spinlock. The mutex must be used to protect a critical region which is shared between coroutines and (optionally) other code running in a non-coroutine (i.e. regular threaded) context.
|
inline |
Default constructor.
|
delete |
|
inline |
Locks this mutex.
The mutex object yields (or conditionally sleeps) the current thread for a short period of time until locking succeeds. See YieldingThreadDuration for more details.
|
inline |
Locks this mutex.
The mutex object yields the current coroutine until locking succeeds.
[in] | sync | Pointer to a coroutine synchronization object. |
|
inline |
Tries to lock the mutex object.
|
inline |
Unlock this mutex.