#include <OnixS/CME/iLink3/threading/Semaphore.h>
Public Member Functions | |
Semaphore (unsigned int count=1) | |
~Semaphore () | |
void | acquire () |
bool | tryAcquire () |
void | release () |
Limits number of threads that can access the shared resource simultaneously.
Definition at line 32 of file Semaphore.h.
Semaphore | ( | unsigned int | count = 1 | ) |
Constructor.
The state of the semaphore is signaled when its counter is greater than zero and non-signaled when it is zero.
count | the counter value. |
~Semaphore | ( | ) |
void acquire | ( | ) |
Decrements the counter by one.
If the counter is already zero, blocks the thread until the counter becomes greater than zero.
void release | ( | ) |
Increments the counter by one.
bool tryAcquire | ( | ) |
Tries to decrement the counter by one.
true
.