SourcePro® 2023.1 |
SourcePro® API Reference Guide |
Base class for guard classes. More...
#include <rw/sync/RWTGuardBase.h>
Public Member Functions | |
~RWTGuardBase () | |
void | acquire () |
bool | isAcquired () const |
void | release () |
Protected Member Functions | |
RWTGuardBase (Resource &resource) | |
RWTGuardBase (Resource &resource, bool acquired) | |
Resource & | resource () const |
Private Member Functions | |
RWTGuardBase (const RWTGuardBase< Resource > &second) | |
RWTGuardBase & | operator= (const RWTGuardBase< Resource > &second) |
RWTGuardBase is intended as a base class for guard classes. 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 when created 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 the synchronization classes in this module.
|
inline |
Destructor.
|
inlineprotected |
Constructs an instance with the given resource.
|
inlineprotected |
Constructs an instance with the given resource. If acquired is true
, the resource is assumed to be owned by the caller.
|
private |
Dummy copy constructor, required by derived class copy constructors. The copy constructor does not attempt to copy the resource.
|
inline |
Acquires the resource held by the guard unless it has already been acquired. Use this function instead of directly manipulating the resource so that the guard will automatically release or acquire it (as appropriate).
|
inline |
Returns true
if the resource is currently acquired, otherwise false
.
|
private |
Assignment prohibited.
|
inline |
Releases the resource held by the guard if it has been acquired. Use this function instead of directly manipulating the resource so that the guard will automatically release or acquire it (as appropriate).
|
inlineprotected |
Returns a reference to the resource currently held by the guard.
Copyright © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |