vrpn 07.35
Virtual Reality Peripheral Network
|
An RAII lock/guard class for vrpn_Semaphore. More...
#include <vrpn_Thread.h>
Public Member Functions | |
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.
Definition at line 129 of file vrpn_Thread.h.
|
explicit |
Constructor that locks (p) the semaphore.
Definition at line 430 of file vrpn_Thread.C.
References lock().
vrpn::SemaphoreGuard::SemaphoreGuard | ( | vrpn_Semaphore & | sem, |
try_to_lock_t | |||
) |
overload that only tries to lock (condP) - doesn't block.
Definition at line 438 of file vrpn_Thread.C.
References try_to_lock().
vrpn::SemaphoreGuard::~SemaphoreGuard | ( | ) |
Destructor that unlocks if we've locked.
Definition at line 446 of file vrpn_Thread.C.
References unlock().
void vrpn::SemaphoreGuard::lock | ( | ) |
Locks the semaphore, if we haven't locked it already.
Definition at line 449 of file vrpn_Thread.C.
References vrpn_Semaphore::p().
Referenced by SemaphoreGuard().
|
inline |
Checks to see if we locked.
Definition at line 141 of file vrpn_Thread.h.
bool vrpn::SemaphoreGuard::try_to_lock | ( | ) |
Tries to lock - returns true if we locked it.
Definition at line 459 of file vrpn_Thread.C.
References vrpn_Semaphore::condP().
Referenced by SemaphoreGuard().
void vrpn::SemaphoreGuard::unlock | ( | ) |
Unlocks the resource, if we have locked it.
Definition at line 470 of file vrpn_Thread.C.
References ALL_ASSERT, and vrpn_Semaphore::v().
Referenced by ~SemaphoreGuard().