#include <PhxSemaphore.h>
Public Member Functions | |
| Semaphore (uint32_t initialValue=0) | |
| Constructs a semaphore, optionally with a non-zero initial value. | |
| void | signal (void) |
| Atomically increments the semaphore value. | |
| void | wait (void) |
| Waits until the semaphore takes on a non-zero value and then decrements it. | |
| int | value (void) |
A semaphore represents an unsigned integral value that may be incremented and decremented atomically. When the value reaches zero, any attempts to decrement the semaphore (by calling wait()) will result in the caller block. If the value is non-zero then it will be decremented and the caller may continue. The semaphore value is incremented by calling signal().
|
|
Constructs a semaphore, optionally with a non-zero initial value.
|
|
|
Atomically increments the semaphore value. If that value was zero, this potentially causes a caller waiting concurrently in a call to wait() to unblock (and subsequently decrement the semaphore again). |
|
|
Waits until the semaphore takes on a non-zero value and then decrements it. If the semaphore value is zero then the caller will be blocked. After a call to signal() gives the semaphore a non-zero value, one caller will unblock and decrement the count before returning. Any additional callers will have to wait for additional calls to signal() to allow them to return. |
1.4.2