Semaphore Class Reference

Semaphore class. More...

#include <Thread.h>

List of all members.

Public Member Functions

 Semaphore ()
 Class constructor.
virtual ~Semaphore ()
 Class destructor.
void post ()
 Post semaphore.
bool pend ()
 Pend on semaphore.
bool pend (int ms)
 Pend on semaphore with timeout.

Detailed Description

Semaphore class.

Implements a semaphore based on pthread mutex and conditional.


Constructor & Destructor Documentation

Semaphore::Semaphore (  ) 

Class constructor.

Initializes the semaphore object. Initial state of the semaphore is not posted.

Semaphore::~Semaphore (  )  [virtual]

Class destructor.

Terminates the semaphore object. The semaphore is not posted before termination.


Member Function Documentation

bool Semaphore::pend ( int  ms  ) 

Pend on semaphore with timeout.

Pends on the semaphore (or waits, acquires the semaphore) for the given amount of time. The call will block until another thread posts the semaphore, or the timeout expires.

Parameters:
ms Pending operation timeout, in milliseconds.
Returns:
Returns true if the semaphore has been posted. Returns false on a timeout condition or if the call has been interrupted.
bool Semaphore::pend (  ) 

Pend on semaphore.

Pends on the semaphore (or waits, acquires the semaphore). The call will block until another thread posts the semaphore.

Returns:
Returns true if the semaphore has been posted. Returns false if the call has been interrupted.
void Semaphore::post (  ) 

Post semaphore.

Posts (or signals, releases) a semaphore. The first thread pending on the semaphore will be released.


The documentation for this class was generated from the following files:
Generated on Wed Oct 20 11:13:44 2010 for libspatha by  doxygen 1.6.3