Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
|
#include <semaphore.h>
Public Member Functions | |
Semaphore (unsigned counter=0) | |
Initialize semaphore with given counter. More... | |
ROC_ATTR_NODISCARD bool | timed_wait (nanoseconds_t deadline) |
Wait until the counter becomes non-zero, decrement it, and return true. If deadline expires before the counter becomes non-zero, returns false. Deadline should be in the same time domain as core::timestamp(). More... | |
void | wait () |
Wait until the counter becomes non-zero, decrement it, and return. More... | |
void | post () |
Increment counter and wake up blocked waits. This method is lock-free. More... | |
Semaphore (unsigned counter=0) | |
Initialize semaphore with given counter. More... | |
ROC_ATTR_NODISCARD bool | timed_wait (nanoseconds_t deadline) |
Wait until the counter becomes non-zero, decrement it, and return true. If deadline expires before the counter becomes non-zero, returns false. Deadline should be in the same time domain as core::timestamp(). More... | |
void | wait () |
Wait until the counter becomes non-zero, decrement it, and return. More... | |
void | post () |
Increment counter and wake up blocked waits. This method is lock-free at least on recent glibc and musl versions (which implement POSIX semaphores using a futex and an atomic). More... | |
Definition at line 25 of file semaphore.h.
|
explicit |
Initialize semaphore with given counter.
|
explicit |
Initialize semaphore with given counter.
void roc::core::Semaphore::post | ( | ) |
Increment counter and wake up blocked waits. This method is lock-free.
void roc::core::Semaphore::post | ( | ) |
Increment counter and wake up blocked waits. This method is lock-free at least on recent glibc and musl versions (which implement POSIX semaphores using a futex and an atomic).
ROC_ATTR_NODISCARD bool roc::core::Semaphore::timed_wait | ( | nanoseconds_t | deadline | ) |
Wait until the counter becomes non-zero, decrement it, and return true. If deadline expires before the counter becomes non-zero, returns false. Deadline should be in the same time domain as core::timestamp().
ROC_ATTR_NODISCARD bool roc::core::Semaphore::timed_wait | ( | nanoseconds_t | deadline | ) |
Wait until the counter becomes non-zero, decrement it, and return true. If deadline expires before the counter becomes non-zero, returns false. Deadline should be in the same time domain as core::timestamp().
void roc::core::Semaphore::wait | ( | ) |
Wait until the counter becomes non-zero, decrement it, and return.
void roc::core::Semaphore::wait | ( | ) |
Wait until the counter becomes non-zero, decrement it, and return.