![]() |
VR-Link API Documentation for HLA 1.3
|
DtScopedLock provides a Boost source compatible scoped lock for DtMutex. More...
Collaboration diagram for DtScopedLock:Public Member Functions | |
| DtScopedLock (DtMutex &mx, bool initially_locked=true) | |
| Constructs a DtScopedLock on a mutex and conditionally locks that mutex. | |
| ~DtScopedLock () | |
| Destructor, which will unlock if the mutex was locked. | |
| void | lock () |
| Lock the mutex. | |
| void | unlock () |
| Unlock the mutex. | |
| bool | locked () const |
| operator const void * () const | |
| else null pointer. | |
Protected Attributes | |
| DtMutex & | myMutex |
| bool | myLockedState |
Private Member Functions | |
| DtScopedLock (const DtScopedLock &) | |
| Ensures non-copiable. | |
| DtScopedLock & | operator= (const DtScopedLock &) |
DtScopedLock provides a Boost source compatible scoped lock for DtMutex.
A DtScopedLock is a safe locking pattern for use in multi-threaded applications. DtScopedLock is non-copiable object, which should be created on the stack. The lock ensures that upon deallocation the lock is released.
DtMutex io_mutex;
Constructs a DtScopedLock on a mutex and conditionally locks that mutex.
| DtScopedLock::~DtScopedLock | ( | ) |
Destructor, which will unlock if the mutex was locked.
|
private |
Ensures non-copiable.
| void DtScopedLock::lock | ( | ) |
Lock the mutex.
| bool DtScopedLock::locked | ( | ) | const |
| true | The mutex is locked. |
| false | The mutex is unlocked. |
| DtScopedLock::operator const void * | ( | ) | const |
else null pointer.
|
private |
| void DtScopedLock::unlock | ( | ) |
Unlock the mutex.
|
protected |
|
protected |