An RAII lock/guard class for vrpn_Semaphore 更多...
#include <vrpn_Thread.h>
Public 成员函数 | |
| SemaphoreGuard (vrpn_Semaphore &sem) | |
| Constructor that locks (p) the semaphore | |
| SemaphoreGuard (vrpn_Semaphore &sem, try_to_lock_t) | |
| overload that only tries to lock (condP) - doesn't block. | |
| ~SemaphoreGuard () | |
| Destructor that unlocks if we've locked. | |
| bool | locked () const |
| Checks to see if we locked. | |
| void | lock () |
| Locks the semaphore, if we haven't locked it already. | |
| bool | try_to_lock () |
| Tries to lock - returns true if we locked it. | |
| void | unlock () |
| Unlocks the resource, if we have locked it. | |
An RAII lock/guard class for vrpn_Semaphore
|
explicit |
Constructor that locks (p) the semaphore
| SemaphoreGuard | ( | vrpn_Semaphore & | sem, |
| try_to_lock_t | ) |
overload that only tries to lock (condP) - doesn't block.
| ~SemaphoreGuard | ( | ) |
Destructor that unlocks if we've locked.
| void lock | ( | ) |
Locks the semaphore, if we haven't locked it already.
|
inline |
Checks to see if we locked.
| bool try_to_lock | ( | ) |
Tries to lock - returns true if we locked it.
| void unlock | ( | ) |
Unlocks the resource, if we have locked it.