Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
roc::core::Timer Class Reference

Thread-safe timer. More...

#include <timer.h>

Inheritance diagram for roc::core::Timer:
Collaboration diagram for roc::core::Timer:

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...
 

Detailed Description

Thread-safe timer.

Definition at line 25 of file timer.h.

Member Function Documentation

◆ try_set_deadline()

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.

◆ wait_deadline()

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.


The documentation for this class was generated from the following file: