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

regina::NMutex::MutexLock Class Reference

A utility class for locking and unlocking a mutex. More...

#include <nthread.h>

List of all members.

Public Member Functions

 MutexLock (const NMutex *mutex)
 Creates a lock for the given mutex.
 MutexLock (const NMutex &mutex)
 Creates a lock for the given mutex.
 ~MutexLock ()
 Unlocks the mutex handled by this object.


Detailed Description

A utility class for locking and unlocking a mutex.

A mutex is locked by simply declaring a local variable of type NMutex::MutexLock. The mutex will be unlocked when this variable goes out of scope.


Constructor & Destructor Documentation

regina::NMutex::MutexLock::MutexLock const NMutex mutex  )  [inline]
 

Creates a lock for the given mutex.

If some other thread has already locked the given mutex, this thread will be suspended until the mutex is unlocked by the other thread. This thread will then lock the mutex itself.

Parameters:
mutex the mutex to be locked by this object. This is const to simplify using mutex locks with data retrieval routines for subclasses of NMutex.

regina::NMutex::MutexLock::MutexLock const NMutex mutex  )  [inline]
 

Creates a lock for the given mutex.

If some other thread has already locked the given mutex, this thread will be suspended until the mutex is unlocked by the other thread. This thread will then lock the mutex itself.

Parameters:
mutex the mutex to be locked by this object. This is const to simplify using mutex locks with data retrieval routines for subclasses of NMutex.

regina::NMutex::MutexLock::~MutexLock  )  [inline]
 

Unlocks the mutex handled by this object.


The documentation for this class was generated from the following file:
Copyright © 1999-2004, Ben Burton
This software is released under the GNU General Public License.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@debian.org).