Semaphore Class Reference
#include <Semaphore.h>
Inheritance diagram for Semaphore:
Public Member Functions | |
Semaphore (int count=1, unsigned int maxCount=1) | |
virtual | ~Semaphore () |
Destroy the Semaphore. | |
void | wait () |
bool | tryWait (unsigned long timeout) |
void | post () |
virtual int | count () |
virtual bool | tryAcquire (unsigned long timeout) |
virtual void | acquire () |
virtual void | release () |
Detailed Description
- Author:
- Eric Crahen <http://www.code-foo.com>
- Date:
- <2003-07-16T15:28:01-0400>
- Version:
- 2.2.1
- Acquiring the Semaphore means taking a permit, but if there are none (the count is 0) the Semaphore will block the calling thread.
- Releasing the Semaphore means returning a permit, unblocking a thread waiting for one.
A Semaphore with an initial value of 1 and maximum value of 1 will act as a Mutex.
Threads blocked on a Semaphore are resumed in FIFO order.
Constructor & Destructor Documentation
|
Create a new Semaphore.
|
Member Function Documentation
|
Decrement the count, blocking that calling thread if the count becomes 0 or less than 0. The calling thread will remain blocked until the count is raised above 0 or if an exception is thrown.
Implements Lockable. |
|
Get the current count of the semaphore. This value may change immediately after this function returns to the calling thread.
|
|
Provided to reflect the traditional Semaphore semantics
|
|
Increment the count, unblocking one thread if count is positive.
Implements Lockable. |
|
Decrement the count, blocking that calling thread if the count becomes 0 or less than 0. The calling thread will remain blocked until the count is raised above 0, an exception is thrown or the given amount of time expires.
Implements Lockable. |
|
Provided to reflect the traditional Semaphore semantics
|
|
Provided to reflect the traditional Semaphore semantics
|
The documentation for this class was generated from the following file:
- Semaphore.h