Public Methods |
| Semaphore_ () |
| Init to default.
|
| ~Semaphore_ () |
| dtor.
|
void | reset () |
| reset(): wakes up all threads waiting on the semaphore and then sets the value to 0.
|
void | increment (size_t Inc=1) |
| increment(Inc): increases the semaphore value by Inc (1 by default).
|
void | wait () |
| wait(): Waits until the semaphore value is 0.
|
void | decrement_and_signal (size_t Dec=1) |
| decrement_and_signal(Dec): decreases the semaphore value by Dec (1 by default) and signals a thread waiting on the semaphore when the value goes 0 (or below).
|
void | decrement_and_broadcast (size_t Dec=1) |
| decrement_and_broadcast(Dec): same as decrement_and_signal(Dec) but broadcasts to all threads waiting on the semaphore when Value goes to 0.
|
Private Methods |
| Semaphore_ (const Semaphore_ &) |
Semaphore_& | operator= (const Semaphore_ &) |
Private Attributes |
int | Value |
pthread_cond_t | Cond |
| condition variable for Value=0.
|
pthread_mutex_t | Mtx |
| the associated mutex.
|