mirror of
https://github.com/ETLCPP/etl.git
synced 2026-04-30 19:09:10 +08:00
1.2 KiB
1.2 KiB
| title |
|---|
| task |
{{< callout type="info">}}
Header: task.h
{{< /callout >}}
The base for tasks controlled by etl::scheduler.
Types
etl::task_priority_t
The type for task priorities.
task
task(task_priority_t priority)
Constructor.
Sets the task priority.
virtual ~task();
Virtual destructor
virtual uint32_t task_request_work() const = 0;
The derived task must override this.
Should return a value that represents the amount of work to do. This may be the number of items in the task's message queue, for example.
Return zero if the task requires no processing time.
virtual void task_process_work() = 0;
The derived task must override this.
The task should process one unit of work.
virtual void on_task_added()
The derived task may override this.
By default, does nothing.
Since: 19.4.0
void set_task_running(bool task_running)
Enables/disables the task from processing work.
Enabled by default.
bool task_is_running() const;
Returns true if the task is in the 'running' state.
etl::task_priority_t get_task_priority() const
Returns the priority of the task.