![]() |
PIP 5.6.1
Platform-Independent Primitives
|
Scope guard that acquires semaphore units in constructor and releases them in destructor. More...
#include <pisemaphore.h>
Public Member Functions | |
| PISemaphoreLocker (PISemaphore &s, int cnt=1, bool condition=true) | |
Constructs and acquire "cnt" resources on semaphore "s" if "condition" is true. | |
| ~PISemaphoreLocker () | |
Release "cnt" resources on semaphore if "condition" was true. | |
Scope guard that acquires semaphore units in constructor and releases them in destructor.
PISemaphore autolocker
When a PISemaphoreLocker object is created, it attempts to acquire the semaphore resources, if "condition" true. When control leaves the scope in which the PISemaphoreLocker object was created, the PISemaphoreLocker is destructed and the resources are released, if "condition" was true.
If "condition" false this class do nothing.
The PISemaphoreLocker class is non-copyable.