Tasks

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.

task_current

Get current task id.

Syntax

id = task_current

See also

task_info

task_info

Information about the current tasks.

Syntax

task_info
task_info(id)

See also

task_new

task_kill

Delete a periodic task.

Syntax

task_kill(id)
task_kill

See also

task_new

task_new

Create a new periodic task.

Syntax

id = task_new(cmd)
id = task_new(cmd, h)
id = task_new(cmd, h, kind)

See also

task_kill, task_onerror

task_onerror

Install a command executed when an error occurs in a task.

Syntax

task_onerror(cmd)

See also

task_new

task_running

Get the list of tasks or check if a task is still running.

Syntax

id_vec = task_running
b = task_running(id)

See also

task_kill

task_settimer

Change the frequency of a task.

Syntax

task_settimer(h)
task_settimer(h, id)

See also

task_new


Copyright 2002-2012, Calerga.
All rights reserved.