SCIRun
5.0
|
#include <Semaphore.h>
Public Member Functions | |
Semaphore (const char *name, int count) | |
~Semaphore () | |
Destroy the semaphore. More... | |
void | up (int count=1) |
void | down (int count=1) |
bool | tryDown () |
Semaphore | ( | const char * | name, |
int | count | ||
) |
Create the semaphore, and setup the initial count.name should be a static string which describes the primitive for debugging purposes.
~Semaphore | ( | ) |
Destroy the semaphore.
void down | ( | int | count = 1 | ) |
Decrement the semaphore count by count. If the count is zero, this thread will be blocked until another thread calls the up method. The order in which threads will be unblocked is not defined, but implementors should give preference to those threads that have waited the longest.
bool tryDown | ( | ) |
Attempt to decrement the semaphore count by one, but will never block. If the count was zero, tryDown will return false. Otherwise, tryDown will return true.
void up | ( | int | count = 1 | ) |
Increment the semaphore count, unblocking up to count threads that may be blocked in the down method.