#include <Semaphore.h>
Inheritance diagram for ZThread::Semaphore::
Public Methods | |
Semaphore (int count=1, int maxCount=1) throw (Synchronization_Exception) | |
virtual | ~Semaphore () throw () |
void | wait () throw (Synchronization_Exception) |
bool | tryWait (unsigned long) throw (Synchronization_Exception) |
void | post () throw (Synchronization_Exception) |
virtual int | count () throw () |
virtual bool | tryAcquire (unsigned long) throw (Synchronization_Exception) |
virtual void | acquire () throw (Synchronization_Exception) |
virtual void | release () throw (Synchronization_Exception) |
A semaphore with a maximum of one is a binary semaphore and basically acts as a mutex. A mutex will be a little more efficient than a binary semaphore in most cases.
|
Create a new Semaphore.
|
|
Destroy the Semaphore |
|
Decrements the semaphore. If the count is 0 - block until its raised above 0.
Reimplemented from ZThread::Lockable. |
|
Current value of the semaphore
|
|
|
|
Increment the semaphore
Reimplemented from ZThread::Lockable. |
|
Decrements the semaphore. If the count is 0 - block until its raised above 0.
Reimplemented from ZThread::Lockable. |
|
|
|
|