nidas v1.2.3
|
Autolock is used a simple guard object for critical sections. More...
#include <ThreadSupport.h>
Public Member Functions | |
Autolock (Cond &cond) | |
Construct the guard object and lock() the lock. | |
Autolock (Mutex &mutex) | |
Construct the guard object and lock() the lock. | |
~Autolock () | |
On destruction, unlock the lock. | |
Private Member Functions | |
Autolock (const Autolock &) | |
Autolock & | operator= (const Autolock &) |
Private Attributes | |
Mutex * | _mutexp |
Cond * | _condp |
Autolock is used a simple guard object for critical sections.
Upon construction it lock()s the given Lock, and then when it goes out of scope, either through a normal exit or an exception, it will be destroyed and the Lock will be unlock()ed. Inside the critical section the thread can call wait() on the Synchronized object to wait on the Lock condition.
|
inline |
Construct the guard object and lock() the lock.
Exception |
References nidas::util::Cond::lock().
|
inline |
Construct the guard object and lock() the lock.
Exception |
References nidas::util::Mutex::lock().
|
inline |
On destruction, unlock the lock.
References _condp, _mutexp, nidas::util::Mutex::unlock(), and nidas::util::Cond::unlock().
|
private |
|
private |
Referenced by ~Autolock().
|
private |
Referenced by ~Autolock().