#include <CountingSemaphore.h>
Inheritance diagram for ZThread::CountingSemaphore:

Public Member Functions | |
| CountingSemaphore (int initialCount=0) | |
| virtual | ~CountingSemaphore () |
| Destroy the CountingSemaphore. | |
| void | wait () |
| bool | tryWait (unsigned long timeout) |
| void | post () |
| virtual int | count () |
| virtual bool | tryAcquire (unsigned long timeout) |
| virtual void | acquire () |
| virtual void | release () |
It differs from a normal Semaphore in that there is no upper bound on the count and it will not throw an exception because a maximum value has been exceeded.
| ZThread::CountingSemaphore::CountingSemaphore | ( | int | initialCount = 0 |
) |
| void ZThread::CountingSemaphore::acquire | ( | ) | [virtual] |
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.
| Interrupted_Exception | thrown when the calling thread is interrupted. A thread may be interrupted at any time, prematurely ending any wait. |
Implements ZThread::Lockable.
| int ZThread::CountingSemaphore::count | ( | ) | [virtual] |
Get the current count of the semaphore.
This value may change immediately after this function returns to the calling thread.
| void ZThread::CountingSemaphore::post | ( | ) |
| void ZThread::CountingSemaphore::release | ( | ) | [virtual] |
Increment the count, unblocking one thread if count is positive.
Implements ZThread::Lockable.
| bool ZThread::CountingSemaphore::tryAcquire | ( | unsigned long | timeout | ) | [virtual] |
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.
| timeout | maximum amount of time (milliseconds) this method could block |
| Interrupted_Exception | thrown when the calling thread is interrupted. A thread may be interrupted at any time, prematurely ending any wait. |
Implements ZThread::Lockable.
| bool ZThread::CountingSemaphore::tryWait | ( | unsigned long | timeout | ) |
| void ZThread::CountingSemaphore::wait | ( | ) |
1.4.7