Lunchbox
1.6.0
|
A scoped mutex. More...
#include <scopedMutex.h>
Public Member Functions | |
ScopedMutex (L *lock) | |
Construct a new scoped mutex and set the given lock. | |
ScopedMutex (L &lock) | |
Construct a new scoped mutex and set the given lock. | |
ScopedMutex (const ScopedMutex &rhs) | |
Move lock from rhs to new mutex. | |
ScopedMutex & | operator= (ScopedMutex &rhs) |
Move lock from rhs to this mutex. | |
template<typename LB > | |
ScopedMutex (const LB &lockable) | |
Construct a new scoped mutex for the given Lockable data structure. | |
~ScopedMutex () | |
Destruct the scoped mutex and unset the mutex. | |
void | leave () |
Leave and unlock the mutex immediately. |
A scoped mutex.
The mutex is automatically set upon creation, and released when the scoped mutex is destroyed, e.g., when the scope is left. The scoped mutex does nothing if a 0 pointer for the lock is passed.
Definition at line 58 of file scopedMutex.h.
lunchbox::ScopedMutex< L, T >::ScopedMutex | ( | L * | lock | ) | [inline, explicit] |
Construct a new scoped mutex and set the given lock.
Providing no Lock (0) is allowed, in which case the scoped mutex does nothing.
lock | the mutex to set and unset, or 0. |
Definition at line 72 of file scopedMutex.h.
lunchbox::ScopedMutex< L, T >::ScopedMutex | ( | L & | lock | ) | [inline, explicit] |
Construct a new scoped mutex and set the given lock.
Definition at line 76 of file scopedMutex.h.
lunchbox::ScopedMutex< L, T >::ScopedMutex | ( | const ScopedMutex< L, T > & | rhs | ) | [inline] |
lunchbox::ScopedMutex< L, T >::ScopedMutex | ( | const LB & | lockable | ) | [inline, explicit] |
Construct a new scoped mutex for the given Lockable data structure.
Definition at line 98 of file scopedMutex.h.
lunchbox::ScopedMutex< L, T >::~ScopedMutex | ( | ) | [inline] |
Destruct the scoped mutex and unset the mutex.
Definition at line 102 of file scopedMutex.h.
References lunchbox::ScopedMutex< L, T >::leave().
void lunchbox::ScopedMutex< L, T >::leave | ( | ) | [inline] |
Leave and unlock the mutex immediately.
Definition at line 105 of file scopedMutex.h.
Referenced by lunchbox::ScopedMutex< L, T >::~ScopedMutex().
ScopedMutex& lunchbox::ScopedMutex< L, T >::operator= | ( | ScopedMutex< L, T > & | rhs | ) | [inline] |