![]() |
PIP 5.5.3
Platform-Independent Primitives
|
PISemaphore autolocker 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. | |
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.