A task that needs to performed by a plugin.
More...
#include <process/Task.hpp>
|
enum class | Timing { RealTime
, RealTimeCompatible
, Conventional
} |
| The timing contraints of the task. More...
|
|
enum class | Stage {
Startup
, PreOperational
, Operational
, PostOperational
,
Shutdown
, Suspended
, Terminated
, internal
} |
| The operational stages of Xentara. More...
|
|
enum class | Status { Pending
, Ready
, Completed
} |
| The status a task within an operational stage. More...
|
|
using | Stages = utils::core::Flags< Stage > |
| A combination of operational stages.
|
|
A task that needs to performed by a plugin.
- See also
- Publishing Tasks
-
Tasks in the Xentara user manual
◆ Stages
A combination of operational stages.
◆ Stage
The operational stages of Xentara.
Enumerator |
---|
Startup | The startup stage. This stage is executed when Xentara starts up.
|
PreOperational | The pre-operational stage. This stage is executed after the startup stage, and when a paused workload is restarted.
|
Operational | The operational stage. This stage is executed while the workload is running.
|
PostOperational | This stage is executed before the shutdown stage, and when a workload is suspended.
|
Shutdown | This stage is executed once on Xentara shutdown.
|
Suspended | This stage denotes that a workload has been suspended. No operation takes place in the suspended stage.
|
Terminated | This is a pseudo-stage denotes that Xentara has terminated completely.
|
◆ Status
The status a task within an operational stage.
Enumerator |
---|
Pending | The task has not yet completed the work it needs to do in this stage.
A task should return this status if it needs to be executed again to finish the work for this stage.
Xentara will remain in the current stage, and the task will be executed again once an event or a timer
it is attached to is triggered.
|
Ready | The task has completed the work it needs to do in this stage, but still wants to be executed.
A task should return this status if it has completed all the work necessary to finish the stage, but
needs to be executed while other tasks complete their work. The task will keep being executed
whenever an event or a timer it is attached to is triggered, until all tasks in all tracks have finished their
work for this stage.
@note It is not possible to go back to the pending state once a task has returned this status. Once a
task has returned \a Ready for a certain stage, returning \a Pending later in the same stage
has no effect. The stage will remain completed, but the task will be executed again as if it has returned
\a Ready.
|
Completed | The task has completely finished the work it needs to do in this stage.
A task should return this status if it has completed all the work it needs to do for this stage, and
doesn't have to be called again for this stage.
|
◆ Timing
The timing contraints of the task.
Enumerator |
---|
RealTime | The task must be executed as a real-time task.
|
RealTimeCompatible | The task can be executed as a real-time task, but need not.
|
Conventional | The task cannot be executed as a real-time task.
|
◆ ~Task()
xentara::process::Task::~Task |
( |
| ) |
|
|
pure virtualdefault |
◆ operational()
virtual auto xentara::process::Task::operational |
( |
const ExecutionContext & |
context | ) |
-> void |
|
pure virtual |
Called by the framework to perform the operational stage.
- Parameters
-
context | A context that allows access to time stamps, counters, etc. |
◆ postOperational()
Called by the framework to perform the post-operational stage.
- Default Implementation
- The default implementation returns Status::Completed.
- Parameters
-
context | A context that allows access to time stamps, counters, etc. |
- Returns
- The execution status for the current stage.
Reimplemented in xentara::process::StageAgnosticTask.
◆ preOperational()
Called by the framework to perform the pre-operational stage.
- Default Implementation
- The default implementation returns Status::Completed.
- Parameters
-
context | A context that allows access to time stamps, counters, etc. |
- Returns
- The execution status for the current stage.
Reimplemented in xentara::process::StageAgnosticTask.
◆ preparePostOperational()
Called by the framework once at the beginning of the post-operational stage.
- Default Implementation
- The default implementation returns Status::Pending.
- Parameters
-
context | A context that allows access to time stamps, counters, etc. |
- Returns
- The execution status for the current stage.
Reimplemented in xentara::process::StageAgnosticTask.
◆ preparePreOperational()
Called by the framework once at the beginning of the pre-operational stage.
- Default Implementation
- The default implementation returns Status::Pending.
- Parameters
-
context | A context that allows access to time stamps, counters, etc. |
- Returns
- The execution status for the current stage.
Reimplemented in xentara::process::StageAgnosticTask.
◆ prepareShutdown()
Called by the framework once at the beginning of the shutdown stage.
- Default Implementation
- The default implementation returns Status::Pending.
- Parameters
-
context | A context that allows access to time stamps, counters, etc. |
- Returns
- The execution status for the current stage.
Reimplemented in xentara::process::StageAgnosticTask.
◆ prepareStartup()
Called by the framework once at the beginning of the startup stage.
- Default Implementation
- The default implementation returns Status::Pending.
- Parameters
-
context | A context that allows access to time stamps, counters, etc. |
- Returns
- The execution status for the current stage.
Reimplemented in xentara::process::StageAgnosticTask.
◆ schedule()
Called by the framework when the task is scheduled in an execution pipeline.
- Note
- This function may be called multiple times of the task is added to multiples timers and/or event.
- Default Implementation
- The default implementation does nothing.
- Parameters
-
track | The track that the pipeline belongs to. This is an opaque reference, but its address can be used to identify the track that the task is being scheduled to. This is useful, e.g., to check whether two tasks have been scheduled to run in different tracks, or whether the same task is being scheduled to more than one track. |
timerSchedule | The schedule of the timer, or std::nullopt if the task is being added to an event. |
- Exceptions
-
std::exception | An exception of this type can be thrown if the scheduling is not acceptable. You can throw an exception of this type if two tasks that need to be in the same track are scheduled in different tracks. |
◆ shutdown()
Called by the framework to perform the shutdown stage.
- Default Implementation
- The default implementation returns Status::Completed.
- Parameters
-
context | A context that allows access to time stamps, counters, etc. |
- Returns
- The execution status for the current stage.
Reimplemented in xentara::process::StageAgnosticTask.
◆ stages()
virtual auto xentara::process::Task::stages |
( |
| ) |
const -> Stages |
|
virtual |
◆ startup()
Called by the framework to perform the startup stage.
- Default Implementation
- The default implementation returns Status::Completed.
- Parameters
-
context | A context that allows access to time stamps, counters, etc. |
- Returns
- The execution status for the current stage.
Reimplemented in xentara::process::StageAgnosticTask.
◆ timing()
virtual auto xentara::process::Task::timing |
( |
| ) |
const -> Timing |
|
virtual |
Called by the framework to get the timing requirements.
- Default Implementation
- The default implementation returns Timing::Conventional.
◆ kReconnect
The standard name for the reconnect task of an I/O component.