![]() |
dfx 0.1.0
Linux-based dynamic dataflow executor
|
Polymorphic unit of work executed by the runtime (typically by ThreadPool). More...
#include <dfx-runtime/tasks/Task.hpp>
Public Member Functions | |
| Task (int priority=0) | |
| Construct a task with a given scheduling priority. | |
| DISABLE_COPY_AND_MOVE (Task) | |
| Tasks are neither copyable nor movable. | |
| virtual | ~Task ()=default |
| Polymorphic base requires a virtual destructor. | |
| int | priority () const noexcept |
| Task scheduling priority. | |
| virtual void | run ()=0 |
| Execute the task. | |
| template<DerivedFromTask T> | |
| T & | as () |
| Unchecked downcast to a concrete task type. | |
| template<DerivedFromTask T> | |
| T const & | as () const |
| Unchecked downcast to a concrete task type (const overload). | |
Polymorphic unit of work executed by the runtime (typically by ThreadPool).
A Task represents a single executable work item that can be scheduled and executed asynchronously by runtime components such as ThreadPool (and, transitively, the Scheduler).
Tasks carry a priority used for scheduling decisions:
Tasks are:
|
inline |
Construct a task with a given scheduling priority.
Higher value means higher priority (executed sooner).
| priority | Scheduling priority for this task. |
|
virtualdefault |
Polymorphic base requires a virtual destructor.
|
inline |
Unchecked downcast to a concrete task type.
| T | Concrete task type (must derive from Task). |
T.
|
inline |
Unchecked downcast to a concrete task type (const overload).
| T | Concrete task type (must derive from Task). |
T.| dfx::Runtime::Task::DISABLE_COPY_AND_MOVE | ( | Task | ) |
Tasks are neither copyable nor movable.
|
inlinenoexcept |
Task scheduling priority.
|
pure virtual |
Execute the task.
Called by the runtime when the task is selected for execution. Implementations should keep execution time reasonable and avoid blocking indefinitely to prevent starving other work.
Implemented in dfx::Runtime::ASyncTask< Func >, and dfx::Runtime::NodeTask< Func >.