Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ACE_Recursive_Thread_Mutex Class Reference

Implement a C++ wrapper that allows nested acquisition and release of a mutex that occurs in the same thread. More...

#include <Recursive_Thread_Mutex.h>

Collaboration diagram for ACE_Recursive_Thread_Mutex:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ACE_Recursive_Thread_Mutex (const ACE_TCHAR *name=0, ACE_mutexattr_t *arg=0)
 Initialize a recursive mutex.
 ~ACE_Recursive_Thread_Mutex (void)
 Implicitly release a recursive mutex.
int remove (void)
int acquire (void)
int tryacquire (void)
int acquire_read (void)
int acquire_write (void)
int tryacquire_read (void)
int tryacquire_write (void)
int tryacquire_write_upgrade (void)
int release (void)
ACE_thread_t get_thread_id (void)
 Return the id of the thread that currently owns the mutex.
int get_nesting_level (void)
ACE_recursive_thread_mutex_tmutex (void)
 Returns a reference to the recursive mutex;.
ACE_thread_mutex_t & get_nesting_mutex (void)
 Returns a reference to the recursive mutex's internal mutex;.
void dump (void) const
 Dump the state of an object.

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.

Protected Member Functions

void set_thread_id (ACE_thread_t t)

Protected Attributes

ACE_recursive_thread_mutex_t lock_
 Recursive mutex.
int removed_

Private Member Functions

void operator= (const ACE_Recursive_Thread_Mutex &)
 ACE_Recursive_Thread_Mutex (const ACE_Recursive_Thread_Mutex &)

Detailed Description

Implement a C++ wrapper that allows nested acquisition and release of a mutex that occurs in the same thread.


Constructor & Destructor Documentation

ACE_Recursive_Thread_Mutex::ACE_Recursive_Thread_Mutex const ACE_TCHAR name = 0,
ACE_mutexattr_t *  arg = 0
 

Initialize a recursive mutex.

ACE_Recursive_Thread_Mutex::~ACE_Recursive_Thread_Mutex void   ) 
 

Implicitly release a recursive mutex.

ACE_Recursive_Thread_Mutex::ACE_Recursive_Thread_Mutex const ACE_Recursive_Thread_Mutex  )  [private]
 


Member Function Documentation

int ACE_Recursive_Thread_Mutex::acquire void   ) 
 

Acquire a recursive mutex (will increment the nesting level and not deadmutex if the owner of the mutex calls this method more than once).

ACE_INLINE int ACE_Recursive_Thread_Mutex::acquire_read void   ) 
 

Acquire mutex ownership. This calls <acquire> and is only here to make the <ace_recusive_thread_mutex> interface consistent with the other synchronization APIs.

ACE_INLINE int ACE_Recursive_Thread_Mutex::acquire_write void   ) 
 

Acquire mutex ownership. This calls <acquire> and is only here to make the <ace_recusive_thread_mutex> interface consistent with the other synchronization APIs.

void ACE_Recursive_Thread_Mutex::dump void   )  const
 

Dump the state of an object.

int ACE_Recursive_Thread_Mutex::get_nesting_level void   ) 
 

Return the nesting level of the recursion. When a thread has acquired the mutex for the first time, the nesting level == 1. The nesting level is incremented every time the thread acquires the mutex recursively.

ACE_INLINE ACE_thread_mutex_t & ACE_Recursive_Thread_Mutex::get_nesting_mutex void   ) 
 

Returns a reference to the recursive mutex's internal mutex;.

ACE_thread_t ACE_Recursive_Thread_Mutex::get_thread_id void   ) 
 

Return the id of the thread that currently owns the mutex.

ACE_INLINE ACE_recursive_thread_mutex_t & ACE_Recursive_Thread_Mutex::mutex void   ) 
 

Returns a reference to the recursive mutex;.

void ACE_Recursive_Thread_Mutex::operator= const ACE_Recursive_Thread_Mutex  )  [private]
 

int ACE_Recursive_Thread_Mutex::release void   ) 
 

Releases a recursive mutex (will not release mutex until all the nesting level drops to 0, which means the mutex is no longer held).

int ACE_Recursive_Thread_Mutex::remove void   ) 
 

Implicitly release a recursive mutex. Note that only one thread should call this method since it doesn't protect against race conditions.

ACE_INLINE void ACE_Recursive_Thread_Mutex::set_thread_id ACE_thread_t  t  )  [protected]
 

int ACE_Recursive_Thread_Mutex::tryacquire void   ) 
 

Conditionally acquire a recursive mutex (i.e., won't block). Returns -1 on failure. If we "failed" because someone else already had the lock, <errno> is set to <ebusy>.

ACE_INLINE int ACE_Recursive_Thread_Mutex::tryacquire_read void   ) 
 

Conditionally acquire mutex (i.e., won't block). This calls <tryacquire> and is only here to make the <ace_recusive_thread_mutex> interface consistent with the other synchronization APIs. Returns -1 on failure. If we "failed" because someone else already had the lock, <errno> is set to <ebusy>.

ACE_INLINE int ACE_Recursive_Thread_Mutex::tryacquire_write void   ) 
 

Conditionally acquire mutex (i.e., won't block). This calls <tryacquire> and is only here to make the <ace_recusive_thread_mutex> interface consistent with the other synchronization APIs. Returns -1 on failure. If we "failed" because someone else already had the lock, <errno> is set to <ebusy>.

ACE_INLINE int ACE_Recursive_Thread_Mutex::tryacquire_write_upgrade void   ) 
 

This is only here to make the <ace_recursive_thread_mutex> interface consistent with the other synchronization APIs. Assumes the caller has already acquired the mutex using one of the above calls, and returns 0 (success) always.


Member Data Documentation

ACE_Recursive_Thread_Mutex::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

ACE_recursive_thread_mutex_t ACE_Recursive_Thread_Mutex::lock_ [protected]
 

Recursive mutex.

int ACE_Recursive_Thread_Mutex::removed_ [protected]
 

Keeps track of whether <remove> has been called yet to avoid multiple <remove> calls, e.g., explicitly and implicitly in the destructor. This flag isn't protected by a lock, so make sure that you don't have multiple threads simultaneously calling <remove> on the same object, which is a bad idea anyway...


The documentation for this class was generated from the following files:
Generated on Wed Jun 8 23:56:14 2005 for ACE by  doxygen 1.3.9.1