![]() |
Taskflow
3.2.0-Master-Branch
|
class to create a runtime object used by a runtime task More...
#include <graph.hpp>
Public Member Functions | |
Executor & | executor () |
obtains the running executor | |
void | schedule (Task task) |
schedules an active task immediately to the worker's queue | |
template<typename C > | |
void | run (C &&) |
runs a task callable synchronously | |
Friends | |
class | Executor |
class to create a runtime object used by a runtime task
A runtime object is used by a runtime task for users to interact with the scheduling runtime, such as scheduling an active task and spawning a subflow.
A runtime task is associated with an executor and a worker that runs the runtime task.
|
inline |
obtains the running executor
The running executor of a runtime task is the executor that runs the parent taskflow of that runtime task.
|
inline |
schedules an active task immediately to the worker's queue
task | the given active task to schedule immediately |
This member function immediately schedules an active task to the task queue of the associated worker in the runtime task. An active task is a task in a running taskflow. The task may or may not be running, and scheduling that task will immediately put the task into the task queue of the worker that is running the runtime task. Consider the following example:
The executor will first run the condition task A
which returns 0
to inform the scheduler to go to the runtime task B
. During the execution of B
, it directly schedules task C
without going through the normal taskflow graph scheduling process. At this moment, task C
is active because its parent taskflow is running. When the taskflow finishes, we will see both B
and C
in the output.