A guard that acquires its resource upon creation and releases it upon destruction.
More...
template<class Resource>
class RWTLockGuard< Resource >
RWTLockGuard is a guard class that acquires its resource upon creation and releases it upon destruction. Guard objects work in conjunction with block statements to establish an appropriate state upon creation, maintain that state for the duration of the block, and restore the original state upon destruction. For example, a guard may acquire a mutex upon creation and release it when destructed. The class used as the actual template parameter for Resource
must be one that provides acquire()
and release()
methods, such as provided by the Threads Module synchronization classes.
- Example
#include <rw/sync/RWMutexLock.h>
#include <rw/sync/RWTLockGuard.h>
void foo() {
}
Implements a mutex, or mutual exclusion lock.
Definition RWMutexLock.h:231
A guard that acquires its resource upon creation and releases it upon destruction.
Definition RWTLockGuard.h:61
- See also
- RWTTryLockGuard, RWTUnlockGuard