ACE_Read_Guard< ACE_LOCK > Class Template Reference

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

#include <Guard_T.h>

Inheritance diagram for ACE_Read_Guard< ACE_LOCK >:

Inheritance graph
[legend]
Collaboration diagram for ACE_Read_Guard< ACE_LOCK >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

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

 ACE_Read_Guard (ACE_LOCK &m, int block)
int acquire_read (void)
 Explicitly acquire the read lock.

int acquire (void)
 Explicitly acquire the read lock.

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

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

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


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 it is instantiated with must support the appropriate API).

Definition at line 163 of file Guard_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 154 of file Guard_T.inl.

References ACE_Read_Guard< ACE_LOCK >::acquire_read().

00155   : ACE_Guard<ACE_LOCK> (&m)
00156 {
00157   this->acquire_read ();
00158 }

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 161 of file Guard_T.inl.

References ACE_Read_Guard< ACE_LOCK >::acquire_read(), and ACE_Read_Guard< ACE_LOCK >::tryacquire_read().

00163   : ACE_Guard<ACE_LOCK> (&m)
00164 {
00165   if (block)
00166     this->acquire_read ();
00167   else
00168     this->tryacquire_read ();
00169 }


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< ACE_LOCK >.

Definition at line 136 of file Guard_T.inl.

00137 {
00138   return this->owner_ = this->lock_->acquire_read ();
00139 }

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

Explicitly acquire the read lock.

Definition at line 130 of file Guard_T.inl.

Referenced by ACE_Read_Guard< ACE_LOCK >::ACE_Read_Guard().

00131 {
00132   return this->owner_ = this->lock_->acquire_read ();
00133 }

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

Dump the state of an object.

Reimplemented from ACE_Guard< ACE_LOCK >.

Definition at line 53 of file Guard_T.cpp.

References ACE_Guard< ACE_LOCK >::dump().

00054 {
00055 // ACE_TRACE ("ACE_Read_Guard<ACE_LOCK>::dump");
00056   ACE_Guard<ACE_LOCK>::dump ();
00057 }

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< ACE_LOCK >.

Definition at line 148 of file Guard_T.inl.

00149 {
00150   return this->owner_ = this->lock_->tryacquire_read ();
00151 }

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 142 of file Guard_T.inl.

Referenced by ACE_Read_Guard< ACE_LOCK >::ACE_Read_Guard().

00143 {
00144   return this->owner_ = this->lock_->tryacquire_read ();
00145 }


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 11:27:48 2006 for ACE by doxygen 1.3.6