Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
ipipeline_task_scheduler.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Roc Streaming authors
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
8 
9 //! @file roc_pipeline/ipipeline_task_scheduler.h
10 //! @brief Pipeline task scheduler interface.
11 
12 #ifndef ROC_PIPELINE_IPIPELINE_TASK_SCHEDULER_H_
13 #define ROC_PIPELINE_IPIPELINE_TASK_SCHEDULER_H_
14 
15 #include "roc_core/time.h"
16 
17 namespace roc {
18 namespace pipeline {
19 
20 class PipelineLoop;
21 
22 //! Pipeline task scheduler interface.
23 //! PipelineLoop uses this interface to schedule asynchronous work.
24 //! Method calls may come from different threads, but are serialized.
26 public:
27  virtual ~IPipelineTaskScheduler();
28 
29  //! Schedule asynchronous work.
30  //!
31  //! @p pipeline calls this when it wants to invoke PipelineLoop::process_tasks()
32  //! asynchronously.
33  //!
34  //! @p deadline is a hint when it's better to invoke the method. It's an absolute
35  //! timestamp in nanoseconds from the same clock domain as core::timestamp().
36  //!
37  //! Zero deadline means invoke as soon as possible.
38  virtual void schedule_task_processing(PipelineLoop& pipeline,
39  core::nanoseconds_t deadline) = 0;
40 
41  //! Cancel previously scheduled asynchronous work.
42  virtual void cancel_task_processing(PipelineLoop& pipeline) = 0;
43 };
44 
45 } // namespace pipeline
46 } // namespace roc
47 
48 #endif // ROC_PIPELINE_IPIPELINE_TASK_SCHEDULER_H_
Pipeline task scheduler interface. PipelineLoop uses this interface to schedule asynchronous work....
virtual void schedule_task_processing(PipelineLoop &pipeline, core::nanoseconds_t deadline)=0
Schedule asynchronous work.
virtual void cancel_task_processing(PipelineLoop &pipeline)=0
Cancel previously scheduled asynchronous work.
Base class for task-based pipelines.
int64_t nanoseconds_t
Nanoseconds.
Definition: time.h:58
Root namespace.
Time definitions.