ACE_Write_Guard< ACE_LOCK > Class Template Reference

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

#include <Guard_T.h>

Inheritance diagram for ACE_Write_Guard< ACE_LOCK >:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

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

 ACE_Write_Guard (ACE_LOCK &m, int block)
int acquire_write (void)
 Explicitly acquire the write lock.

int acquire (void)
 Explicitly acquire the write lock.

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

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

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


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

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

References ACE_Write_Guard< ACE_LOCK >::acquire_write().

00089   : ACE_Guard<ACE_LOCK> (&m)
00090 {
00091   this->acquire_write ();
00092 }

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

References ACE_Write_Guard< ACE_LOCK >::acquire_write(), and ACE_Write_Guard< ACE_LOCK >::tryacquire_write().

00121   : ACE_Guard<ACE_LOCK> (&m)
00122 {
00123   if (block)
00124     this->acquire_write ();
00125   else
00126     this->tryacquire_write ();
00127 }


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

Definition at line 101 of file Guard_T.inl.

00102 {
00103   return this->owner_ = this->lock_->acquire_write ();
00104 }

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

Explicitly acquire the write lock.

Definition at line 95 of file Guard_T.inl.

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

00096 {
00097   return this->owner_ = this->lock_->acquire_write ();
00098 }

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

Dump the state of an object.

Reimplemented from ACE_Guard< ACE_LOCK >.

Definition at line 42 of file Guard_T.cpp.

References ACE_Guard< ACE_LOCK >::dump().

00043 {
00044 #if defined (ACE_HAS_DUMP)
00045 // ACE_TRACE ("ACE_Write_Guard<ACE_LOCK>::dump");
00046   ACE_Guard<ACE_LOCK>::dump ();
00047 #endif /* ACE_HAS_DUMP */
00048 }

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

Definition at line 113 of file Guard_T.inl.

00114 {
00115   return this->owner_ = this->lock_->tryacquire_write ();
00116 }

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

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

00108 {
00109   return this->owner_ = this->lock_->tryacquire_write ();
00110 }


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