SourcePro® API Reference Guide

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

A base class for guard classes that acquire write access to a resource upon creation and release it upon destruction. More...

#include <rw/sync/RWTWriteLockGuardBase.h>

Inheritance diagram for RWTWriteLockGuardBase< Resource >:
RWTWriteGuardBase< Resource > RWTTryWriteLockGuard< Resource > RWTWriteLockGuard< Resource >

Public Member Functions

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

Protected Member Functions

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

Private Member Functions

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

Detailed Description

template<class Resource>
class RWTWriteLockGuardBase< Resource >

RWTWriteLockGuardBase is a base class for guard classes that acquire write 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 write access on a mutex when created and release it when destructed.

The class used as the actual template parameter for Resource must provide acquireWrite() and release() methods, such as the synchronization classes in this module.

See also
RWTTryWriteLockGuard, RWTWriteUnlockGuard

Constructor & Destructor Documentation

◆ ~RWTWriteLockGuardBase()

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

Releases the resource if it has been acquired.

◆ RWTWriteLockGuardBase() [1/3]

template<class Resource >
RWTWriteLockGuardBase< Resource >::RWTWriteLockGuardBase ( Resource & resource)
inlineprotected
Deprecated
As of SourcePro 13, use RWTWriteLockGuardBase(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.

◆ RWTWriteLockGuardBase() [2/3]

template<class Resource >
RWTWriteLockGuardBase< Resource >::RWTWriteLockGuardBase ( 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.

◆ RWTWriteLockGuardBase() [3/3]

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

Copy construction prohibited.

Member Function Documentation

◆ operator=()

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

Assignment prohibited.

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