Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_Read_Guard Class Template Reference

This class is similar to class <ACE_Guard>, though it acquires/releases a read lock automatically (naturally, the <ACE_LOCK> it is instantiated with must support the appropriate API). More...

#include <Synch_T.h>

Inheritance diagram for ACE_Read_Guard:

Inheritance graph
[legend]
Collaboration diagram for ACE_Read_Guard:

Collaboration graph
[legend]
List of all members.

Public Methods

 ACE_Read_Guard (ACE_LOCK &m)
 Implicitly and automatically acquire a read lock. More...

 ACE_Read_Guard (ACE_LOCK &m, int block)
 Implicitly and automatically acquire (or try to acquire) a read lock. More...

int acquire_read (void)
 Explicitly acquire the read lock. More...

int acquire (void)
 Explicitly acquire the read lock. More...

int tryacquire_read (void)
 Conditionally acquire the read lock (i.e., won't block). More...

int tryacquire (void)
 Conditionally acquire the read lock (i.e., won't block). More...

void dump (void) const
 Dump the state of an object. More...


Detailed Description

template<class ACE_LOCK>
class ACE_Read_Guard< ACE_LOCK >

This class is similar to class <ACE_Guard>, though it acquires/releases a read lock automatically (naturally, the <ACE_LOCK> it is instantiated with must support the appropriate API).

Definition at line 471 of file Synch_T.h.


Constructor & Destructor Documentation

template<class ACE_LOCK>
ACE_INLINE ACE_Read_Guard< ACE_LOCK >::ACE_Read_Guard ACE_LOCK &    m
 

Implicitly and automatically acquire a read lock.

Definition at line 151 of file Synch_T.i.

References acquire_read.

00152   : ACE_Guard<ACE_LOCK> (&m)
00153 {
00154   this->acquire_read ();
00155 }

template<class ACE_LOCK>
ACE_INLINE ACE_Read_Guard< ACE_LOCK >::ACE_Read_Guard ACE_LOCK &    m,
int    block
 

Implicitly and automatically acquire (or try to acquire) a read lock.

Definition at line 158 of file Synch_T.i.

References acquire_read, and tryacquire_read.

00160   : ACE_Guard<ACE_LOCK> (&m)
00161 {
00162   if (block)
00163     this->acquire_read ();
00164   else
00165     this->tryacquire_read ();
00166 }


Member Function Documentation

template<class ACE_LOCK>
ACE_INLINE int ACE_Read_Guard< ACE_LOCK >::acquire void   
 

Explicitly acquire the read lock.

Reimplemented from ACE_Guard.

Definition at line 133 of file Synch_T.i.

References ACE_Guard::lock_, and ACE_Guard::owner_.

00134 {
00135   return this->owner_ = this->lock_->acquire_read ();
00136 }

template<class ACE_LOCK>
ACE_INLINE int ACE_Read_Guard< ACE_LOCK >::acquire_read void   
 

Explicitly acquire the read lock.

Definition at line 127 of file Synch_T.i.

References ACE_Guard::lock_, and ACE_Guard::owner_.

Referenced by ACE_Read_Guard.

00128 {
00129   return this->owner_ = this->lock_->acquire_read ();
00130 }

template<class ACE_LOCK>
void ACE_Read_Guard< ACE_LOCK >::dump void    const
 

Dump the state of an object.

Reimplemented from ACE_Guard.

Definition at line 62 of file Synch_T.cpp.

References ACE_Guard::dump.

00063 {
00064 // ACE_TRACE ("ACE_Read_Guard<ACE_LOCK>::dump");
00065   ACE_Guard<ACE_LOCK>::dump ();
00066 }

template<class ACE_LOCK>
ACE_INLINE int ACE_Read_Guard< ACE_LOCK >::tryacquire void   
 

Conditionally acquire the read lock (i.e., won't block).

Reimplemented from ACE_Guard.

Definition at line 145 of file Synch_T.i.

References ACE_Guard::lock_, and ACE_Guard::owner_.

00146 {
00147   return this->owner_ = this->lock_->tryacquire_read ();
00148 }

template<class ACE_LOCK>
ACE_INLINE int ACE_Read_Guard< ACE_LOCK >::tryacquire_read void   
 

Conditionally acquire the read lock (i.e., won't block).

Definition at line 139 of file Synch_T.i.

References ACE_Guard::lock_, and ACE_Guard::owner_.

Referenced by ACE_Read_Guard.

00140 {
00141   return this->owner_ = this->lock_->tryacquire_read ();
00142 }


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:54:56 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002