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

MutexLock< MUTEX > Class Template Reference

Quick mutex locker which unlocks on destruction. More...

#include <mutex.h>

Collaboration diagram for MutexLock< MUTEX >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 MutexLock (MUTEX &mutex)
 Constructor: lock the passed mutex.

 ~MutexLock ()
 Destructor: unlock the passed mutex.

MUTEX * operator-> ()
 This can be used to access the mutex. Probably seldom needed.


Private Attributes

MUTEX & m

Detailed Description

template<typename MUTEX>
class MutexLock< MUTEX >

Quick mutex locker which unlocks on destruction.

Author:
Wolfgang Wieser ] wwieser (a) gmx <*> de [
MutexLock is a simple and useful template for both of the above Mutex classes. The constructor locks the mutex and the destructor unlocks it. This makes sure that the mutex is unlocked as soon as the function is left e.g. via return or C++ exception.

Definition at line 242 of file mutex.h.


Constructor & Destructor Documentation

template<typename MUTEX>
MutexLock< MUTEX >::MutexLock MUTEX &  mutex  )  [inline]
 

Constructor: lock the passed mutex.

Definition at line 249 of file mutex.h.

References MutexLock< MUTEX >::m.

template<typename MUTEX>
MutexLock< MUTEX >::~MutexLock  )  [inline]
 

Destructor: unlock the passed mutex.

Definition at line 251 of file mutex.h.

References MutexLock< MUTEX >::m.


Member Function Documentation

template<typename MUTEX>
MUTEX* MutexLock< MUTEX >::operator->  )  [inline]
 

This can be used to access the mutex. Probably seldom needed.

Definition at line 254 of file mutex.h.

References MutexLock< MUTEX >::m.


Member Data Documentation

template<typename MUTEX>
MUTEX& MutexLock< MUTEX >::m [private]
 

Definition at line 245 of file mutex.h.

Referenced by MutexLock< MUTEX >::MutexLock(), MutexLock< MUTEX >::operator->(), and MutexLock< MUTEX >::~MutexLock().


The documentation for this class was generated from the following file:
Generated on Sat Feb 19 22:35:32 2005 for Ray by doxygen 1.3.5