Portable counting semaphore with indefinite waits.
More...
#include <semaphore.h>
|
| | Semaphore (int32_t count=0) |
| | Creates a semaphore with an initial count.
|
| |
| void | release (int32_t count) |
| | Increments semaphore count by the specified amount.
|
| |
| bool | wait () |
| | Decrements semaphore count by 1. If the count is already 0, it waits indefinitely until semaphore count is incremented, then decrements and returns. Returns false when an error occurs, otherwise returns true.
|
| |
Portable counting semaphore with indefinite waits.
◆ Semaphore()
| gaia::mt::Semaphore::Semaphore |
( |
int32_t |
count = 0 | ) |
|
|
inlineexplicit |
Creates a semaphore with an initial count.
- Parameters
-
| count | Initial permit count. |
◆ release()
| void gaia::mt::Semaphore::release |
( |
int32_t |
count | ) |
|
|
inline |
Increments semaphore count by the specified amount.
- Parameters
-
| count | Number of permits to release. Must be positive. |
◆ wait()
| bool gaia::mt::Semaphore::wait |
( |
| ) |
|
|
inline |
Decrements semaphore count by 1. If the count is already 0, it waits indefinitely until semaphore count is incremented, then decrements and returns. Returns false when an error occurs, otherwise returns true.
- Returns
- True when a permit was acquired successfully.
The documentation for this class was generated from the following file:
- /home/runner/work/gaia-ecs/gaia-ecs/include/gaia/mt/semaphore.h