#include <pmutex.h>
Public Member Functions | |
| Lock (Mutex &mutex) | |
| ~Lock () | |
| Lock & | operator= (Mutex &mutex) |
The lock guard class is used to do exception-safe locking. Simply put a Lock object on the Stack. When the stack-frame is unwinded (by a throw, or a return) the Mutex will be unlocked. The following example shows how to use the Lock guard:
class X { void a(int val); private: Mutex mtx; int var; } void X::a(int val) { Mutex::Lock l(mtx); var = val; }
Definition at line 125 of file pmutex.h.
|
|
|
|
|
|
|
|
Definition at line 133 of file pmutex.h. References P::Mutex::lock(). |
1.3.3