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

Wefts::RMutex Class Reference

This is a reentrant mutex with spinlock. More...

#include <wefts_rmutex.h>

Inheritance diagram for Wefts::RMutex:

Inheritance graph
[legend]
Collaboration diagram for Wefts::RMutex:

Collaboration graph
[legend]
List of all members.

Public Methods

 RMutex ()
 Initializes the internal data of the mutex.

virtual void lock ()
 Locks the mutex.

virtual void unlock ()
 Unlocks the mutex.


Private Attributes

volatile pthread_t m_owner
volatile int m_lockCount

Detailed Description

This is a reentrant mutex with spinlock.

This mutex ensures that a calling thread can lock and unlock the mutex an equal amount of times without being blocked. This allows to wrap functions that are doing a lock on a mutex around outer functions that must extend the lock in a wider area.

All mutex classes are implemented via inline calls to maximize execution speed; also, their metods are extremely small.


Constructor & Destructor Documentation

Wefts::RMutex::RMutex   [inline]
 

Initializes the internal data of the mutex.


Member Function Documentation

virtual void Wefts::RMutex::lock   [inline, virtual]
 

Locks the mutex.

If the calling thread is already owning the lock, the function will return immediately. Anyhow, it is necessary to call the unlock() metod exactly the same amount of times that it has been called lock() to ensure proper mutex releasing.

Reimplemented from Wefts::Mutex.

virtual void Wefts::RMutex::unlock   [inline, virtual]
 

Unlocks the mutex.

Releases the lock held by the calling thread. If the calling thread is not the rightful owner of the lock, the request is ignored and the call returns immediately.

Reimplemented from Wefts::Mutex.


Member Data Documentation

volatile int Wefts::RMutex::m_lockCount [private]
 

volatile pthread_t Wefts::RMutex::m_owner [private]
 


The documentation for this class was generated from the following file:
Generated on Tue Aug 5 18:09:03 2003 for Wefts by doxygen1.2.18