Regina Calculation Engine
Public Member Functions | List of all members
regina::NMutex::MutexLock Class Reference

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

#include <utilities/nthread.h>

Public Member Functions

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

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
mutexthe 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
mutexthe 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-2014, The Regina development team
This software is released under the GNU General Public License, with some additional permissions; see the source code for details.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@debian.org).