Task
Task
#include <icy/task.h>class TaskDefined in src/base/include/icy/task.h:32
Abstract base class for implementing asynchronous tasks.
Tasks are designed to be run by a TaskRunner.
List of all members
| Name | Kind | Owner |
|---|---|---|
TaskRunner | friend | Declared here |
Task | function | Declared here |
destroy | function | Declared here |
destroyed | function | Declared here |
repeating | function | Declared here |
id | function | Declared here |
~Task | function | Declared here |
Task | function | Declared here |
operator= | function | Declared here |
Task | function | Declared here |
operator= | function | Declared here |
_id | variable | Declared here |
_repeating | variable | Declared here |
_destroyed | variable | Declared here |
run | function | Declared here |
Runnable | function | Inherited from Runnable |
~Runnable | function | Inherited from Runnable |
run | function | Inherited from Runnable |
cancel | function | Inherited from Runnable |
cancelled | function | Inherited from Runnable |
exit | variable | Inherited from Runnable |
Inherited from Runnable
| Kind | Name | Description |
|---|---|---|
function | Runnable inline | |
function | ~Runnable virtual | Defaulted destructor. |
function | run virtual | The run method will be called by the asynchronous context. |
function | cancel virtual inline | Cancel the current task. The run() method should return ASAP. |
function | cancelled virtual const inline | Returns true when the task has been cancelled. |
variable | exit |
Friends
| Name | Description |
|---|---|
TaskRunner | Tasks belong to a TaskRunner instance. |
TaskRunner
friend class TaskRunnerDefined in src/base/include/icy/task.h:77
Tasks belong to a TaskRunner instance.
Public Methods
| Return | Name | Description |
|---|---|---|
Task | ||
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
Task(bool repeat = false)Defined in src/base/include/icy/task.h:37
Parameters
repeatIf true, the[TaskRunner](icy-TaskRunner.html#taskrunner-1)will call[run()](#run-5)repeatedly; if false, the task is cancelled after one execution.
destroy
virtual
virtual void destroy()Defined in src/base/include/icy/task.h:40
Sets the task to destroyed state.
destroyed
virtual const
virtual bool destroyed() constDefined in src/base/include/icy/task.h:43
Signals that the task should be disposed of.
repeating
virtual const
virtual bool repeating() constDefined in src/base/include/icy/task.h:48
Signals that the task should be called repeatedly by the TaskRunner. If this returns false the task will be cancelled.
id
virtual const
virtual uint32_t id() constDefined in src/base/include/icy/task.h:51
Unique task ID.
Task
Task(const Task & task) = deleteDefined in src/base/include/icy/task.h:61
Deleted constructor.
Task
Task(Task &&) = deleteDefined in src/base/include/icy/task.h:63
Deleted constructor.
Protected Attributes
| Return | Name | Description |
|---|---|---|
uint32_t | _id | |
bool | _repeating | |
bool | _destroyed |
_id
uint32_t _idDefined in src/base/include/icy/task.h:79
_repeating
bool _repeatingDefined in src/base/include/icy/task.h:80
_destroyed
bool _destroyedDefined in src/base/include/icy/task.h:81
Protected Methods
| Return | Name | Description |
|---|---|---|
void | run virtual override | 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. |
run
virtual override
virtual void run() overrideDefined in src/base/include/icy/task.h:74
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.
