#include <thread.hpp>
Collaboration diagram for MynahSA::Lock:
Public Member Functions | |
Lock (Mutex &m) | |
constructor - requires a reference to a mutex object, blocks until mutex is acquired | |
~Lock () | |
destructor - releases the mutex |
The usage pattern for class Lock is a single function and/or frame in which the critical section behavior is contained. Consider: void f() { Lock l(myMutex); ... do shared stuff ... } The end of the frame releases the lock. This usage pattern can help prevent faults where locks are left in the acquired state.
Note: Class Lock is unavailable when MYNAHSA_USE_BOOST is set as a compile time option.
Definition at line 108 of file thread.hpp.