A guard that acquires its resource upon creation and releases it upon destruction. More...
#include <rw/sync/RWTLockGuard.h>
Public Member Functions | |
RWTLockGuard (Resource &resource) | |
~RWTLockGuard () | |
Public Member Functions inherited from RWTLockGuardBase< Resource > | |
~RWTLockGuardBase () | |
Public Member Functions inherited from RWTGuardBase< Resource > | |
~RWTGuardBase () | |
void | acquire () |
bool | isAcquired () const |
void | release () |
Private Member Functions | |
RWTLockGuard (const RWTLockGuard< Resource > &second) | |
RWTLockGuard< Resource > & | operator= (const RWTLockGuard< Resource > &second) |
Additional Inherited Members | |
Protected Member Functions inherited from RWTLockGuardBase< Resource > | |
RWTLockGuardBase (Resource &resource) | |
RWTLockGuardBase (Resource &resource, bool acquired) | |
Protected Member Functions inherited from RWTGuardBase< Resource > | |
RWTGuardBase (Resource &resource) | |
RWTGuardBase (Resource &resource, bool acquired) | |
Resource & | resource () const |
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.
|
inline |
Constructs a guard instance with the given resource and acquires that resource. The resource is released in the destructor of the base class.
|
inline |
Destructor.
|
private |
Copy construction prohibited.
|
private |
Assignment prohibited.
Copyright © 2021 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |