Struct ScopedMutexLock
RAII lock for the Mutex class.
struct ScopedMutexLock(M)
if (is(M : Mutex) || is(M : Lockable));
Constructors
Name | Description |
---|---|
this
(mutex, mode)
|
Fields
Name | Type | Description |
---|---|---|
m_locked
|
bool | |
m_mode
|
LockMode | |
m_mutex
|
M |
Properties
Name | Type | Description |
---|---|---|
locked [get]
|
bool |
Methods
Name | Description |
---|---|
lock
()
|
|
tryLock
()
|
|
unlock
()
|
Example
int protected_var = 0;
auto mtx = new TaskMutex;
mtx .performLocked!({
protected_var++;
});