Tasks are code fragments which are executed periodically in the same context as commands typed by the user. They can exchange data via global variables. They are never interrupted; a task always runs from beginning to end before the next task is scheduled or a user command is evaluated.
There are two kinds of tasks: real-time and non-real-time. Each task is installed with task_new and is associated with a timer value which specifies the amount of time between each execution. Real-time tasks have the priority over non-real-time tasks. They cannot be delayed by more than their timer value; if they are, they are set in stale mode and are not scheduled anymore. Real-time tasks do not drift, while non-real-time tasks do. If a real-time becomes stale or if an error occurs in any task, the code fragment installed with task_onerror, if any, is executed.
Get current task id.
id = task_current
Information about the current tasks.
task_info task_info(id)
Delete a periodic task.
task_kill(id) task_kill
Create a new periodic task.
id = task_new(cmd) id = task_new(cmd, h) id = task_new(cmd, h, kind)
Install a command executed when an error occurs in a task.
task_onerror(cmd)
Get the list of tasks or check if a task is still running.
id_vec = task_running b = task_running(id)
Change the frequency of a task.
task_settimer(h) task_settimer(h, id)