vrpn 07.35
Virtual Reality Peripheral Network
Loading...
Searching...
No Matches
vrpn::SemaphoreGuard Class Reference

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.
 

Detailed Description

An RAII lock/guard class for vrpn_Semaphore.

Definition at line 129 of file vrpn_Thread.h.

Constructor & Destructor Documentation

◆ SemaphoreGuard() [1/2]

vrpn::SemaphoreGuard::SemaphoreGuard ( vrpn_Semaphore & sem)
explicit

Constructor that locks (p) the semaphore.

Definition at line 430 of file vrpn_Thread.C.

References lock().

Here is the call graph for this function:

◆ SemaphoreGuard() [2/2]

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().

Here is the call graph for this function:

◆ ~SemaphoreGuard()

vrpn::SemaphoreGuard::~SemaphoreGuard ( )

Destructor that unlocks if we've locked.

Definition at line 446 of file vrpn_Thread.C.

References unlock().

Here is the call graph for this function:

Member Function Documentation

◆ lock()

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().

Here is the call graph for this function:

◆ locked()

bool vrpn::SemaphoreGuard::locked ( ) const
inline

Checks to see if we locked.

Definition at line 141 of file vrpn_Thread.h.

◆ try_to_lock()

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().

Here is the call graph for this function:

◆ unlock()

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().

Here is the call graph for this function:

The documentation for this class was generated from the following files: