#include <icy/task.h>Abstract base class for implementing asynchronous tasks.
Tasks are designed to be run by a TaskRunner.
| Return | Name | Description |
|---|---|---|
Task | #### Parameters | |
void | destroy virtual | Sets the task to destroyed state. |
bool | destroyed virtual const | Signals that the task should be disposed of. |
bool | repeating virtual const | Signals that the task should be called repeatedly by the TaskRunner. If this returns false the task will be cancelled. |
uint32_t | id virtual const | Unique task ID. |
Task | Deleted constructor. | |
Task | Deleted constructor. |
Task(bool repeat)repeat If true, the [TaskRunner](icy-TaskRunner.html#taskrunner) will call [run()](#run-5) repeatedly; if false, the task is cancelled after one execution.virtual
virtual void destroy()Sets the task to destroyed state.
virtual const
virtual bool destroyed() constSignals that the task should be disposed of.
virtual const
virtual bool repeating() constSignals that the task should be called repeatedly by the TaskRunner. If this returns false the task will be cancelled.
virtual const
virtual uint32_t id() constUnique task ID.
Task(const Task & task) = deleteDeleted constructor.
Task(Task &&) = deleteDeleted constructor.
| Return | Name | Description |
|---|---|---|
uint32_t | _id | |
bool | _repeating | |
bool | _destroyed |
uint32_t _idbool _repeatingbool _destroyed| Return | Name | Description |
|---|---|---|
void | run | Called by the TaskRunner to run the task. Override this method to implement task action. Returning true means the task should be called again, and false will cause the task to be destroyed. The task will similarly be destroyed if destroy() was called during the current task iteration. |
void run()Called by the TaskRunner to run the task. Override this method to implement task action. Returning true means the task should be called again, and false will cause the task to be destroyed. The task will similarly be destroyed if destroy() was called during the current task iteration.