LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::semaphore Class Reference

lti semaphore class for inter-thread (not inter-process!) synchronisation More...

#include <ltiSemaphore.h>

Inheritance diagram for lti::semaphore:
Inheritance graph
[legend]
Collaboration diagram for lti::semaphore:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 semaphore (const int initialValue=1)
virtual ~semaphore ()
bool wait ()
bool tryWait ()
bool post ()
int getValue ()
void reset ()
virtual const char * getTypeName () const

Protected Attributes

HANDLE theSemaphore

Detailed Description

lti semaphore class for inter-thread (not inter-process!) synchronisation

See also:
lti::mutex, lti::thread

Constructor & Destructor Documentation

lti::semaphore::semaphore ( const int  initialValue = 1  ) 

default constructor

virtual lti::semaphore::~semaphore (  )  [virtual]

destructor


Member Function Documentation

virtual const char* lti::semaphore::getTypeName (  )  const [virtual]

returns the name of this type

Reimplemented from lti::object.

int lti::semaphore::getValue (  ) 

get current value

bool lti::semaphore::post (  ) 

post semaphore, i.e.

increase the value

Returns:
true if successful, false otherwise
void lti::semaphore::reset (  ) 

reset value to initialValue

bool lti::semaphore::tryWait (  ) 

Try to wait on semaphore, but do not block.

Returns:
true if value was decreased.
bool lti::semaphore::wait (  ) 

wait on semaphore, i.e.

decrease the value or wait if counter <= 0

Returns:
true if successful, false otherwise

Member Data Documentation

HANDLE lti::semaphore::theSemaphore [protected]

the WIN32 semaphore object


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

Generated on Sat Apr 10 15:28:53 2010 for LTI-Lib by Doxygen 1.6.1