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

Wefts::Mutex Class Reference
[Mutexes]

Implements a very fast, non reentrant mutex. More...

#include <wefts_mutex.h>

Inheritance diagram for Wefts::Mutex:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Mutex ()
 Initializes the internal data of the mutex.

 ~Mutex ()
 Destroys the mutex.

virtual void lock ()
 Locks the mutex.

virtual bool trylock ()
 Try to lock the mutex.

virtual void unlock ()
 Unlocks the mutex.


Protected Attributes

OSMutex m_mutex

Friends

class Condition

Detailed Description

Implements a very fast, non reentrant mutex.

This is the fastest and smallest possible mutex. To be used when implementing the condition/mutex raw scheme or when a very small section of uninterruptable code is to be protected.

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


Constructor & Destructor Documentation

Wefts::Mutex::Mutex  )  [inline]
 

Initializes the internal data of the mutex.

Wefts::Mutex::~Mutex  )  [inline]
 

Destroys the mutex.

Only call this when the mutex is fully unlocked: destroyng a locked mutex has undefinded result.


Member Function Documentation

virtual void Wefts::Mutex::lock  )  [inline, virtual]
 

Locks the mutex.

If the calling thread is already owning the lock, the function will block producing an unavodiable and unininterruptable deadlock.

Reimplemented in Wefts::RMutex.

virtual bool Wefts::Mutex::trylock  )  [inline, virtual]
 

Try to lock the mutex.

If any thread is currently holding the mutex, the function returns immediately false, while if it is not locked, the mutex is locked and the function returns true.

Reimplemented in Wefts::RMutex.

virtual void Wefts::Mutex::unlock  )  [inline, virtual]
 

Unlocks the mutex.

This method does not checks if the calling thread is the rightful owner of the mutex; unlocking a mutex from a thread that has not locked it has an undefined outcome.

Reimplemented in Wefts::RMutex.


Friends And Related Function Documentation

friend class Condition [friend]
 


Member Data Documentation

OSMutex Wefts::Mutex::m_mutex [protected]
 


The documentation for this class was generated from the following file:
Generated on Sat Mar 13 21:05:44 2004 for Wefts by doxygen 1.3.5