SourcePro® 2023.1 |
SourcePro® API Reference Guide |
Base class for guard classes that support read access to a given section of code. More...
#include <rw/sync/RWTReadGuardBase.h>
Public Member Functions | |
~RWTReadGuardBase () | |
void | acquire () |
bool | isAcquired () const |
void | release () |
Protected Member Functions | |
RWTReadGuardBase (Resource &resource) | |
RWTReadGuardBase (Resource &resource, bool acquired) | |
Resource & | resource () const |
Private Member Functions | |
RWTReadGuardBase (const RWTReadGuardBase< Resource > &second) | |
RWTReadGuardBase< Resource > & | operator= (const RWTReadGuardBase< Resource > &second) |
RWTReadGuardBase is a base class for guard classes that support read access to a given section of code.
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 for reading upon creation and release it when destructed. The class used as the template parameter Resource
must be one that provides acquireRead() and release() methods, such as the synchronization classes provided in this module.
RWTReadGuardBase< Resource >::~RWTReadGuardBase | ( | ) |
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 |
Copy construction prohibited.
|
inline |
Acquires read access on the resource held by the guard unless access has already been acquired. Use this function rather than manipulating the resource directly so the guard will automatically release or acquire access (as appropriate).
|
inline |
Returns true
if the resource is currently acquired.
|
private |
Assignment prohibited.
|
inline |
Releases the resource held by the guard if it has been acquired. Use this function rather than manipulating the resource directly so the guard will automatically release or acquire access (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. |