An optimized version of Semaphore that avoids expensive system calls when the counter is greater than 0.
More...
#include <semaphore_fast.h>
|
| | SemaphoreFast (int32_t count=0) |
| | Creates a semaphore with the requested initial system-semaphore count.
|
| |
| void | release (int32_t count=1) |
| | 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.
|
| |
An optimized version of Semaphore that avoids expensive system calls when the counter is greater than 0.
◆ SemaphoreFast()
| gaia::mt::SemaphoreFast::SemaphoreFast |
( |
int32_t |
count = 0 | ) |
|
|
inlineexplicit |
Creates a semaphore with the requested initial system-semaphore count.
- Parameters
-
| count | Initial count passed to the underlying semaphore. |
◆ release()
| void gaia::mt::SemaphoreFast::release |
( |
int32_t |
count = 1 | ) |
|
|
inline |
Increments semaphore count by the specified amount.
- Parameters
-
| count | Number of permits to release. |
◆ wait()
| bool gaia::mt::SemaphoreFast::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: