#include <SemaphoreImpl.h>
Public Member Functions | |
SemaphoreImpl (int count, unsigned int maxCount, bool checked) | |
~SemaphoreImpl () | |
void | acquire () |
void | release () |
bool | tryAcquire (unsigned long timeout) |
int | count () |
ZThread::SemaphoreImpl< List >::SemaphoreImpl | ( | int | count, | |
unsigned int | maxCount, | |||
bool | checked | |||
) | [inline] |
Create a new SemaphoreImpl. Initialzes one pthreads mutex for internal use.
Initialization_Exception | thrown if resources could not be properly allocated |
ZThread::SemaphoreImpl< List >::~SemaphoreImpl | ( | ) |
Destroy this SemaphoreImpl and release its resources.
void ZThread::SemaphoreImpl< List >::acquire | ( | ) |
Decrement the count, blocking when that count becomes 0 or less.
Interrupted_Exception | thrown when the caller status is interrupted | |
Synchronization_Exception | thrown if there is some other error. |
int ZThread::SemaphoreImpl< List >::count | ( | ) |
void ZThread::SemaphoreImpl< List >::release | ( | ) |
Increment the count and release a waiter if there are any. If the semaphore is checked, then an exception will be raised if the maximum count is about to be exceeded.
InvalidOp_Exception | thrown if the maximum count is exceeded while the checked flag is set. |
bool ZThread::SemaphoreImpl< List >::tryAcquire | ( | unsigned long | timeout | ) |
Decrement the count, blocking when it that count is 0 or less. If the timeout expires before the count is raise above 0, the thread will stop blocking and return.
Interrupted_Exception | thrown when the caller status is interrupted | |
Synchronization_Exception | thrown if there is some other error. |