Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Loading...
Searching...
No Matches
roc::ctl::ControlLoop Class Reference

Control loop thread. More...

#include <control_loop.h>

Inheritance diagram for roc::ctl::ControlLoop:
roc::ctl::ControlTaskExecutor< ControlLoop > roc::core::NonCopyable< Tag > roc::ctl::IControlTaskExecutor

Classes

class  Tasks
 Subclasses for specific tasks. More...
 

Public Types

typedef struct EndpointHandleEndpointHandle
 Opaque endpoint handle.
 

Public Member Functions

 ControlLoop (netio::NetworkLoop &network_loop, core::IArena &arena)
 Initialize.
 
bool is_valid () const
 Check if the object was successfully constructed.
 
void schedule (ControlTask &task, IControlTaskCompleter *completer)
 Enqueue a task for asynchronous execution as soon as possible. completer will be invoked on control thread when the task completes.
 
void schedule_at (ControlTask &task, core::nanoseconds_t deadline, IControlTaskCompleter *completer)
 Enqueue a task for asynchronous execution at given point of time. deadline defines the absolute point of time when to execute the task. completer will be invoked on control thread when the task completes.
 
ROC_ATTR_NODISCARD bool schedule_and_wait (ControlTask &task)
 Enqueue a task for asynchronous execution and wait until it completes. Combines schedule() and wait() calls.
 
void async_cancel (ControlTask &task)
 Try to cancel scheduled task execution, if it's not executed yet.
 
void wait (ControlTask &task)
 Wait until the task is completed.
 
- Public Member Functions inherited from roc::ctl::IControlTaskExecutor

Detailed Description

Control loop thread.

Remarks
This class is a task-based facade for the whole roc_ctl module.

Definition at line 33 of file control_loop.h.

Member Typedef Documentation

◆ EndpointHandle

Opaque endpoint handle.

Definition at line 36 of file control_loop.h.

Constructor & Destructor Documentation

◆ ControlLoop()

roc::ctl::ControlLoop::ControlLoop ( netio::NetworkLoop & network_loop,
core::IArena & arena )

Initialize.

Member Function Documentation

◆ async_cancel()

void roc::ctl::ControlLoop::async_cancel ( ControlTask & task)

Try to cancel scheduled task execution, if it's not executed yet.

See also
ControlTaskQueue::async_cancel for details.

◆ is_valid()

bool roc::ctl::ControlLoop::is_valid ( ) const

Check if the object was successfully constructed.

◆ schedule()

void roc::ctl::ControlLoop::schedule ( ControlTask & task,
IControlTaskCompleter * completer )

Enqueue a task for asynchronous execution as soon as possible. completer will be invoked on control thread when the task completes.

See also
ControlTaskQueue::schedule for details.

◆ schedule_and_wait()

ROC_ATTR_NODISCARD bool roc::ctl::ControlLoop::schedule_and_wait ( ControlTask & task)

Enqueue a task for asynchronous execution and wait until it completes. Combines schedule() and wait() calls.

Returns
true if the task succeeded or false if it failed.

◆ schedule_at()

void roc::ctl::ControlLoop::schedule_at ( ControlTask & task,
core::nanoseconds_t deadline,
IControlTaskCompleter * completer )

Enqueue a task for asynchronous execution at given point of time. deadline defines the absolute point of time when to execute the task. completer will be invoked on control thread when the task completes.

See also
ControlTaskQueue::schedule_at for details.

◆ wait()

void roc::ctl::ControlLoop::wait ( ControlTask & task)

Wait until the task is completed.

See also
ControlTaskQueue::wait for details.

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