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

#include <vrpn_Thread.h>

Public Member Functions

 vrpn_Semaphore (int cNumResources=1)
 constructor - mutex by default (0 is a sync primitive)
 
 ~vrpn_Semaphore ()
 destructor
 
bool reset (int cNumResources=1)
 routine to reset it (true on success, false on failure) (may create new semaphore)
 
int p ()
 Blocking acquire of resource. ("down")
 
int v ()
 Release of resource. ("up")
 
int condP ()
 Non-blocking attempt to acquire resource ("down")
 
int numResources ()
 read values
 

Detailed Description

Definition at line 63 of file vrpn_Thread.h.

Constructor & Destructor Documentation

◆ vrpn_Semaphore()

vrpn_Semaphore::vrpn_Semaphore ( int  cNumResources = 1)

constructor - mutex by default (0 is a sync primitive)

Definition at line 43 of file vrpn_Thread.C.

◆ ~vrpn_Semaphore()

vrpn_Semaphore::~vrpn_Semaphore ( )

destructor

Definition at line 202 of file vrpn_Thread.C.

Member Function Documentation

◆ condP()

int vrpn_Semaphore::condP ( )

Non-blocking attempt to acquire resource ("down")

Returns
0 if it could not access the resource and 1 if it could (-1 on fail)

Definition at line 337 of file vrpn_Thread.C.

References ALL_ASSERT.

Referenced by vrpn::SemaphoreGuard::try_to_lock(), and vrpn_test_threads_and_semaphores().

◆ numResources()

int vrpn_Semaphore::numResources ( )

read values

Definition at line 407 of file vrpn_Thread.C.

◆ p()

int vrpn_Semaphore::p ( )

Blocking acquire of resource. ("down")

Returns
1 when it has acquired the resource, -1 on fail

Definition at line 232 of file vrpn_Thread.C.

References ALL_ASSERT.

Referenced by vrpn::SemaphoreGuard::lock(), vrpn_test_threads_and_semaphores(), and vrpn_ConnectionManager::~vrpn_ConnectionManager().

◆ reset()

bool vrpn_Semaphore::reset ( int  cNumResources = 1)

routine to reset it (true on success, false on failure) (may create new semaphore)

Definition at line 212 of file vrpn_Thread.C.

◆ v()

int vrpn_Semaphore::v ( )

Release of resource. ("up")

Returns
0 when it has released the resource, -1 on fail

Definition at line 292 of file vrpn_Thread.C.

Referenced by vrpn::SemaphoreGuard::unlock(), vrpn_test_threads_and_semaphores(), and vrpn_ConnectionManager::~vrpn_ConnectionManager().


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