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

DAQThreadRecursiveMutex Class Reference

Provides methods for manipulating a recursive mutex. More...

Inheritance diagram for DAQThreadRecursiveMutex::

DAQObject Printable List of all members.

Public Methods

 DAQThreadRecursiveMutex ()
 Constructor. More...

 ~DAQThreadRecursiveMutex ()
 Destructor. More...

int Lock ()
 Lock mutex. More...

int TryLock ()
 Try to lock mutex. More...

int UnLock ()
 Try to unlock mutex. More...

bool IsLocked ()
 Test if the mutex is locked. More...

int UnLockCompletely ()
 Completely unlock the mutex. More...

virtual void PrintEyeCatcher (ostream &)
 Print an eye catcher. More...


Protected Attributes

daqthread_mutex_t thrdmutex
 The mutex. More...

daqthread_mutex_t monitormutex
 The monitor mutex. More...

daqthread_t owningthread
 The thread that owns this mutex. More...

unsigned int lockdepth
 The depth to which this mutex has been locked. More...


Friends

class DAQThreadCond

Detailed Description

The DAQThreadRecursiveMutex class provides methods that implement a recursive mutex. A recursive mutex is capable of being locked multiple times by the same thread without blocking. Other threads will block on the mutex until the owning thread unlocks the mutex to a recursive depth of zero.

Author:
Eric Kasten
Version:
0.4.0


Constructor & Destructor Documentation

DAQThreadRecursiveMutex::DAQThreadRecursiveMutex
 

Basic constructor method for this class.

Parameters:
None  
Returns:
this

DAQThreadRecursiveMutex::~DAQThreadRecursiveMutex
 

Destructor method for this class.

Parameters:
None  
Returns:
None


Member Function Documentation

bool DAQThreadRecursiveMutex::IsLocked
 

Tests if the mutex is locked and returns true if it is.

Parameters:
None  
Returns:
If the mutex is locked.
Return values:
true   if the mutex is locked.
false   if the mutex isn't locked.

int DAQThreadRecursiveMutex::Lock
 

Attempts to lock the mutex. This method will block if the mutex has been locked by another thread and that thread does not currently own the mutex.

Parameters:
None  
Returns:
When the mutex can be locked by a requesting thread
Return values:
0   if the lock was successful.
<0   if the lock was unsuccessful.

void DAQThreadRecursiveMutex::PrintEyeCatcher ostream & aStream [virtual]
 

Print an eye catcher for this mutex.

Parameters:
aStream   An ostream object to which to print.
Returns:
None

Reimplemented from DAQObject.

int DAQThreadRecursiveMutex::TryLock
 

Attempts to lock the mutex. This method doesn't block if the mutex has been locked by another thread.

Parameters:
None  
Returns:
When the mutex can be locked by a requesting thread
Return values:
0   if the lock was successful.
<0   if the lock was unsuccessful.

int DAQThreadRecursiveMutex::UnLock
 

Attempts to unlock the mutex. Only the owning thread can unlock the mutex.

Parameters:
None  
Returns:
When the mutex can be unlocked by a requesting thread
Return values:
0   if the unlock was successful.
<0   if the unlock was unsuccessful (owned by another thread).

int DAQThreadRecursiveMutex::UnLockCompletely
 

Completely unlocks the mutex such that the recursive locking level is set to zero. This can only be done by the owning thread.

Parameters:
None  
Returns:
If the mutex could be unlocked.
Return values:
0   if the mutex could be unlocked.
<0   if the mutex couldn't be unlocked.


Member Data Documentation

DAQThreadRecursiveMutex::lockdepth [protected]
 

The depth to which the owning thread has locked this mutex.

DAQThreadRecursiveMutex::monitormutex [protected]
 

The monitor mutex that protects the recursive structures used to implement the recursive mutex.

DAQThreadRecursiveMutex::owningthread [protected]
 

The thread that owns this mutex. This thread is allowed to lock the mutex repetively.

DAQThreadRecursiveMutex::thrdmutex [protected]
 

The actual mutex that is locked (recursively).


The documentation for this class was generated from the following files:
Generated at Tue Jan 29 14:07:11 2002 for SpectroDAQ by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001