ACE_Mutex_Invariants Class Reference

Mutex Invariants = INVARIANTS 1. Only one owner at a time. More...

#include <Token_Invariants.h>

List of all members.

Public Member Functions

 ACE_Mutex_Invariants (void)
 Default construction.

int acquired (void)
void releasing (void)
 Updates internal database.

 ACE_Mutex_Invariants (const ACE_Mutex_Invariants &rhs)
 Copy construction.

void operator= (const ACE_Mutex_Invariants &rhs)
 Copy.

void dump (void) const
 Dump the state of the class.


Private Attributes

int owners_
 Number of owners. This had better be 0 >= owners_ <= 1;.


Detailed Description

Mutex Invariants = INVARIANTS 1. Only one owner at a time.

Definition at line 44 of file Token_Invariants.h.


Constructor & Destructor Documentation

ACE_Mutex_Invariants::ACE_Mutex_Invariants void   ) 
 

Default construction.

Definition at line 231 of file Token_Invariants.cpp.

00232 : owners_ (0)
00233 {
00234 }

ACE_Mutex_Invariants::ACE_Mutex_Invariants const ACE_Mutex_Invariants rhs  ) 
 

Copy construction.

Definition at line 255 of file Token_Invariants.cpp.

00256 : owners_ (rhs.owners_)
00257 {
00258 }


Member Function Documentation

int ACE_Mutex_Invariants::acquired void   ) 
 

Returns 1 on success, 0 when an invariant has been violated and -1 on error.

Definition at line 237 of file Token_Invariants.cpp.

References owners_.

Referenced by ACE_Token_Invariant_Manager::mutex_acquired().

00238 {
00239   if (++owners_ > 1)
00240     {
00241       owners_ = 42;
00242       return 0;
00243     }
00244   else
00245     return 1;
00246 }

void ACE_Mutex_Invariants::dump void   )  const
 

Dump the state of the class.

Definition at line 267 of file Token_Invariants.cpp.

References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_LIB_TEXT, ACE_TRACE, LM_DEBUG, and owners_.

00268 {
00269 #if defined (ACE_HAS_DUMP)
00270   ACE_TRACE ("ACE_Mutex_Invariants::dump");
00271   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00272   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("owners_ = %d\n"), owners_));
00273   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00274 #endif /* ACE_HAS_DUMP */
00275 }

void ACE_Mutex_Invariants::operator= const ACE_Mutex_Invariants rhs  ) 
 

Copy.

Definition at line 261 of file Token_Invariants.cpp.

References owners_.

00262 {
00263   owners_ = rhs.owners_;
00264 }

void ACE_Mutex_Invariants::releasing void   ) 
 

Updates internal database.

Definition at line 249 of file Token_Invariants.cpp.

References owners_.

Referenced by ACE_Token_Invariant_Manager::mutex_releasing().

00250 {
00251   if (owners_ == 1)
00252     --owners_;
00253 }


Member Data Documentation

int ACE_Mutex_Invariants::owners_ [private]
 

Number of owners. This had better be 0 >= owners_ <= 1;.

Definition at line 70 of file Token_Invariants.h.

Referenced by acquired(), dump(), operator=(), and releasing().


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