CppELib 1.7.0
|
RAII wrapper of Mutex. More...
#include <Mutex.h>
Classes | |
struct | AdoptLock |
Public Member Functions | |
LockGuard (Mutex *m) | |
Constructor of LockGuard with automatic mutex locking. | |
LockGuard (Mutex *m, AdoptLock adoptLock) | |
Constructor of LockGuard using locked Mutex object. | |
~LockGuard () | |
Destructor of LockGuard. | |
Static Public Attributes | |
static const AdoptLock | ADOPT_LOCK |
Used as argument of LockGuard's constructor. | |
RAII wrapper of Mutex.
A LockGuard object is used as a local variable. While the LockGuard object exists in the scope, the current thread is locking the Mutex. When it goes out of the scope and the LockGuard object ends its life, the Mutex is unlocked automatically.
|
explicit |
Constructor of LockGuard using locked Mutex object.
m | Mutex object that the current thread has already locked by the lock methods, for example tryLock() or timedLock() |
adoptLock | Specify LockGuard::ADOPT_LOCK |
OSWrapper::LockGuard::~LockGuard | ( | ) |
|
static |
Used as argument of LockGuard's constructor.