Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
|
Thread-safe timer. More...
#include <timer.h>
Public Member Functions | |
bool | try_set_deadline (nanoseconds_t deadline) |
Set timer deadline. Can be called concurrently, but only one concurrent call will succeed. Returns false if the call failed because of another concurrent call. Is lock-free if Semaphore::post() is so (which is true of modern plarforms). Current or future wait_deadline() call will unblock when deadline expires. Zero deadline means wake up immediately. Nagative deadline means never wake up, until deadline is changed again. More... | |
void | wait_deadline () |
Wait until deadline expires. Should be called from a single thread. Assumes that wait_deadline() calls are serialized. Deadline may be changed concurrently from other threads. More... | |
bool roc::core::Timer::try_set_deadline | ( | nanoseconds_t | deadline | ) |
Set timer deadline. Can be called concurrently, but only one concurrent call will succeed. Returns false if the call failed because of another concurrent call. Is lock-free if Semaphore::post() is so (which is true of modern plarforms). Current or future wait_deadline() call will unblock when deadline expires. Zero deadline means wake up immediately. Nagative deadline means never wake up, until deadline is changed again.
void roc::core::Timer::wait_deadline | ( | ) |
Wait until deadline expires. Should be called from a single thread. Assumes that wait_deadline() calls are serialized. Deadline may be changed concurrently from other threads.