SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
RWTReadLockGuardBase< Resource > Class Template Reference

Base class for guard classes that acquire read access to a resource upon creation and release it upon destruction. More...

#include <rw/sync/RWTReadLockGuardBase.h>

Inheritance diagram for RWTReadLockGuardBase< Resource >:
RWTReadGuardBase< Resource > RWTReadLockGuard< Resource > RWTTryReadLockGuard< Resource >

Public Member Functions

 ~RWTReadLockGuardBase (void)
 
- Public Member Functions inherited from RWTReadGuardBase< Resource >
 ~RWTReadGuardBase (void)
 
void acquire (void)
 
bool isAcquired (void) const
 
void release (void)
 

Protected Member Functions

 RWTReadLockGuardBase (Resource &resource)
 
 RWTReadLockGuardBase (Resource &resource, bool acquired)
 
- Protected Member Functions inherited from RWTReadGuardBase< Resource >
 RWTReadGuardBase (Resource &resource)
 
 RWTReadGuardBase (Resource &resource, bool acquired)
 
Resource & resource (void) const
 

Private Member Functions

 RWTReadLockGuardBase (const RWTReadLockGuardBase< Resource > &second)
 
RWTReadLockGuardBase< Resource > & operator= (const RWTReadLockGuardBase< Resource > &second)
 

Detailed Description

template<class Resource>
class RWTReadLockGuardBase< Resource >

RWTReadLockGuardBase is a base class for guard classes that acquire read access on a resource upon creation and release 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 read access on a mutex 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.

See also
RWTReadLockGuard, RWTTryReadLockGuard, RWTReadUnlockGuard

Constructor & Destructor Documentation

◆ ~RWTReadLockGuardBase()

template<class Resource >
RWTReadLockGuardBase< Resource >::~RWTReadLockGuardBase ( void )
inline

Releases the resource if it has been acquired.

◆ RWTReadLockGuardBase() [1/3]

template<class Resource >
RWTReadLockGuardBase< Resource >::RWTReadLockGuardBase ( Resource & resource)
inlineprotected
Deprecated
As of SourcePro 13, use RWTReadLockGuardBase(Resource&, bool) instead.

Constructs a guard instance with the given resource. Note that this constructor does not attempt to acquire the resource. That is the responsibility of the derived class.

◆ RWTReadLockGuardBase() [2/3]

template<class Resource >
RWTReadLockGuardBase< Resource >::RWTReadLockGuardBase ( Resource & resource,
bool acquired )
inlineprotected

Constructs a guard instance with the given resource. If acquired is true, the resource is assumed to be owned by the caller. Note that this constructor does not attempt to acquire the resource. That is the responsibility of the derived class.

◆ RWTReadLockGuardBase() [3/3]

template<class Resource >
RWTReadLockGuardBase< Resource >::RWTReadLockGuardBase ( const RWTReadLockGuardBase< Resource > & second)
private

Copy construction prohibited.

Member Function Documentation

◆ operator=()

template<class Resource >
RWTReadLockGuardBase< Resource > & RWTReadLockGuardBase< Resource >::operator= ( const RWTReadLockGuardBase< Resource > & second)
private

Assignment prohibited.

Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.