framexmit::recursivemutex Class Reference
[Frame multicast client/server]

#include <fxmitmutex.hh>

Inheritance diagram for framexmit::recursivemutex:

framexmit::mutex framexmit::abstractsemaphore

List of all members.

Public Member Functions

 recursivemutex ()
 recursivemutex (const recursivemutex &rmux)
recursivemutexoperator= (const recursivemutex &rm)
virtual void lock ()
virtual void unlock ()
virtual bool trylock (locktype lck=rdlock)

Protected Attributes

taskID_t threadID
 Thread identifier.
int refcount
 Reference count.


Detailed Description

This class is used as a wrapper around a system defined mutex. A recursive mutex is similar to a normal mutex object, but it allows a single task/thread to take a mutex multiple times. This is useful for a set of routines/methods that must call each other but that also require mutually exclusive access to a resource. The recursive mutex keeps track which task/thraad currently owns the mutex and also keeps a reference count on how often it was locked. The system mutex will only be released after the last unlock call. Under Unix this mutex is less effcient than the normal mutex, but sometimes convinient. Under VxWorks this is the default behaviour.

brief Class to store a recuresive mutex.

Author:
DS, November 98
See also:
Recursive mutex objects

Constructor & Destructor Documentation

framexmit::recursivemutex::recursivemutex (  )  [inline]

Constructs a recuresive mutex object and creates a new mutex. brief Default constructor.

Returns:
void

framexmit::recursivemutex::recursivemutex ( const recursivemutex rmux  )  [inline]

Constructs a recuresive mutex object by creating a new mutex with reference count zero, rather than copying it. brief Copy constructor.

Parameters:
rmux another recursive mutex
Returns:
void


Member Function Documentation

recursivemutex& framexmit::recursivemutex::operator= ( const recursivemutex rm  )  [inline]

Overrides the default assignment behavior. Does nothing. brief Assignment operator.

Parameters:
rm recursivemutex copy argument
Returns:
refrence to object

virtual void framexmit::recursivemutex::lock (  )  [virtual]

Locks the mutex. If the mutex is alreday taken it checks if the current thread is the same as the one which took the mutex originally. If no, it waits until the mutex becomes free. If yes, it increases the reference count and returns. brief Mutex lock function.

Returns:
void

Reimplemented from framexmit::mutex.

virtual void framexmit::recursivemutex::unlock (  )  [virtual]

Unlocks the mutex. The mutex becomes free. brief Mutex unlock function.

Returns:
void

Reimplemented from framexmit::mutex.

virtual bool framexmit::recursivemutex::trylock ( locktype  lck = rdlock  )  [virtual]

Trys to lock the mutex. If the mutex is alreday taken it checks if current thread is the same as the one which locked the mutex originally. If no, it returns false. If yes, it increases the reference count and returns true.

brief Mutex trylock function.

Parameters:
lck writeaccess ignored
Returns:
true if locked, false otherwise

Reimplemented from framexmit::mutex.


The documentation for this class was generated from the following file:
Generated on Sun Mar 8 19:21:24 2009 for dmt by  doxygen 1.5.4