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

ACE_Write_Guard Class Template Reference

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

#include <Synch_T.h>

Inheritance diagram for ACE_Write_Guard:

Inheritance graph
[legend]
Collaboration diagram for ACE_Write_Guard:

Collaboration graph
[legend]
List of all members.

Public Methods

 ACE_Write_Guard (ACE_LOCK &m)
 Implicitly and automatically acquire a write lock. More...

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

int acquire_write (void)
 Explicitly acquire the write lock. More...

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

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

int tryacquire (void)
 Conditionally acquire the write 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_Write_Guard< ACE_LOCK >

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

Definition at line 427 of file Synch_T.h.


Constructor & Destructor Documentation

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

Implicitly and automatically acquire a write lock.

Definition at line 85 of file Synch_T.i.

References acquire_write.

00086   : ACE_Guard<ACE_LOCK> (&m)
00087 {
00088   this->acquire_write ();
00089 }

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

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

Definition at line 116 of file Synch_T.i.

References acquire_write, and tryacquire_write.

00118   : ACE_Guard<ACE_LOCK> (&m)
00119 {
00120   if (block)
00121     this->acquire_write ();
00122   else
00123     this->tryacquire_write ();
00124 }


Member Function Documentation

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

Explicitly acquire the write lock.

Reimplemented from ACE_Guard.

Definition at line 98 of file Synch_T.i.

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

00099 {
00100   return this->owner_ = this->lock_->acquire_write ();
00101 }

template<class ACE_LOCK>
ACE_INLINE int ACE_Write_Guard< ACE_LOCK >::acquire_write void   
 

Explicitly acquire the write lock.

Definition at line 92 of file Synch_T.i.

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

Referenced by ACE_Write_Guard.

00093 {
00094   return this->owner_ = this->lock_->acquire_write ();
00095 }

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

Dump the state of an object.

Reimplemented from ACE_Guard.

Definition at line 53 of file Synch_T.cpp.

References ACE_Guard::dump.

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

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

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

Reimplemented from ACE_Guard.

Definition at line 110 of file Synch_T.i.

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

00111 {
00112   return this->owner_ = this->lock_->tryacquire_write ();
00113 }

template<class ACE_LOCK>
ACE_INLINE int ACE_Write_Guard< ACE_LOCK >::tryacquire_write void   
 

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

Definition at line 104 of file Synch_T.i.

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

Referenced by ACE_Write_Guard.

00105 {
00106   return this->owner_ = this->lock_->tryacquire_write ();
00107 }


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