nidas  v1.2-1520
Public Member Functions | Private Member Functions | Private Attributes | List of all members
nidas::util::Semaphore Class Reference

A POSIX semaphore. More...

#include <ThreadSupport.h>

Public Member Functions

 Semaphore ()
 Constructor. More...
 
 ~Semaphore ()
 Destructor. More...
 
void wait () throw ()
 Suspend calling thread until the semaphore has a non-zero count. More...
 
bool check () throw ()
 Do a non-blocking wait on the Semaphore. More...
 
void post () throw ()
 Atomically increment the Semaphore. More...
 
int getValue () throw ()
 Get the current value of the Semaphore. More...
 
sem_t * ptr ()
 Get the pointer to the semaphore (for legacy C code). More...
 

Private Member Functions

 Semaphore (const Semaphore &)
 No copying. More...
 
Semaphoreoperator= (const Semaphore &)
 No assignment allowed. More...
 

Private Attributes

sem_t _sem
 

Detailed Description

A POSIX semaphore.

Constructor & Destructor Documentation

nidas::util::Semaphore::Semaphore ( )
inline

Constructor.

nidas::util::Semaphore::~Semaphore ( )
inline

Destructor.

nidas::util::Semaphore::Semaphore ( const Semaphore )
private

No copying.

Member Function Documentation

bool nidas::util::Semaphore::check ( )
throw (
)
inline

Do a non-blocking wait on the Semaphore.

Returns
true Semaphore had a non-zero count, which was decremented. false Semaphore was zero. Not changed.
int nidas::util::Semaphore::getValue ( )
throw (
)
inline

Get the current value of the Semaphore.

Semaphore& nidas::util::Semaphore::operator= ( const Semaphore )
private

No assignment allowed.

void nidas::util::Semaphore::post ( )
throw (
)
inline

Atomically increment the Semaphore.

sem_t* nidas::util::Semaphore::ptr ( )
inline

Get the pointer to the semaphore (for legacy C code).

void nidas::util::Semaphore::wait ( )
throw (
)
inline

Suspend calling thread until the semaphore has a non-zero count.

Then atomically decrement the semaphore count and return;

Member Data Documentation

sem_t nidas::util::Semaphore::_sem
private

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