#include <OnixS/FIXEngine/Threading/Semaphore.h>
Public Member Functions | |
Semaphore (unsigned int count=1) | |
~Semaphore () | |
void | acquire () |
bool | tryAcquire () |
void | release () |
Definition at line 27 of file Semaphore.h.
Semaphore | ( | unsigned int | count = 1 | ) |
Initializes the instance with the given value of the "count".
The
count | indicates the initial "count" for the semaphore. The state of the semaphore is signaled when its count is greater than zero and non-signaled when it is zero. |
~Semaphore | ( | ) |
Destructs the object.
void acquire | ( | ) |
Decrements the semaphore "counter" by one.
If the semaphore "counter" is already zero, blocks the thread until the semaphore "count" becomes greater than zero.
void release | ( | ) |
Increments the semaphore "counter" by one.
If there are other threads waiting for the object, it blocks one the them.
bool tryAcquire | ( | ) |
Tries to acquire the semaphore object.
If its "counter" is already zero, returns false
. In all cases, it doesn't block the thread and quites immediately.