![]() |
PIP 5.6.1
Platform-Independent Primitives
|
Scope guard that locks a PISpinlock in constructor and unlocks it in destructor. More...
#include <pispinlock.h>
Public Member Functions | |
| PISpinlockLocker (PISpinlock &s, bool condition=true) | |
Constructs and lock "s" if "condition" is true. | |
| ~PISpinlockLocker () | |
Unlock "s" if "condition" was true. | |
Scope guard that locks a PISpinlock in constructor and unlocks it in destructor.
PISpinlock autolocker
When a PISpinlockLocker object is created, it attempts to lock the spinlock it is given, if "condition" true. When control leaves the scope in which the PISpinlockLocker object was created, the PISpinlockLocker is destructed and the spinlock is released, if "condition" true.
If "condition" false this class do nothing.
The PISpinlockLocker class is non-copyable.