Semaphore Class Reference

#include </home/sspr/src/www/orocos-1.0/export/build/orocos-rtt-1.2.2/build/rtt/os/Semaphore.hpp>

List of all members.


Detailed Description

An object oriented wrapper around a counting semaphore.

It works like a traffic light on which a thread can wait() until the sempahore's value becomes positive, otherwise it blocks. Another thread then needs to signal() the semaphore. One thread which is waiting will then be awakened, if none is waiting, the first thread calling wait() will continue directly (and decrease the value by 1).

Warning:
Semaphore instances should only be created in soft realtime, since the initialisation of a semaphore can not be done in hard realtime.


Public Member Functions

 Semaphore (int count)
 Initialize a Semaphore with an initial count.
 ~Semaphore ()
 Destroy a Semaphore.
void wait ()
void signal ()
bool trywait ()
 Try to wait on this semaphore.
int value ()


Member Function Documentation

bool trywait (  )  [inline]

Try to wait on this semaphore.

Returns:
true when the locking succeeded ( this->value() was > 0), false otherwise ( this->value() was = 0 )


The documentation for this class was generated from the following file:
Generated on Fri Oct 19 16:27:29 2007 for Orocos by  doxygen 1.5.1