A lightweight C++ object whose constructor calls acquire() and whose destructor calls release() on a mutex. More...
#include "mutexHolder.h"
Public Member Functions | |
MutexHolder (const Mutex &mutex) | |
MutexHolder (const Mutex &mutex, Thread *current_thread) | |
This variant on the constructor accepts the current thread as a parameter, if it is already known, as an optimization. More... | |
MutexHolder (Mutex *&mutex) | |
If the MutexHolder constructor is given a pointer to a Mutex object (instead of an actual object), it will first check to see if the pointer is NULL, and allocate a new Mutex if it is. More... | |
MutexHolder (const MutexHolder ©)=delete | |
MutexHolder & | operator= (const MutexHolder ©)=delete |
A lightweight C++ object whose constructor calls acquire() and whose destructor calls release() on a mutex.
It is a C++ convenience wrapper to call release() automatically when a block exits (for instance, on return).
Definition at line 25 of file mutexHolder.h.
This variant on the constructor accepts the current thread as a parameter, if it is already known, as an optimization.
Definition at line 30 of file mutexHolder.I.
References MutexDirect::acquire().
|
inline |
If the MutexHolder constructor is given a pointer to a Mutex object (instead of an actual object), it will first check to see if the pointer is NULL, and allocate a new Mutex if it is.
This is intended as a convenience for functions that may need to reference a Mutex at static init time, when it is impossible to guarantee ordering of initializers.
Definition at line 48 of file mutexHolder.I.
References MutexDirect::acquire().