krüe :: avrforth :: task

task management

avrforth uses round robin cooperative multitasking. To execute a word in its own task, first allocate enough memory for the task's stacks. Next, initialize the task using task-init and make it active with task-queue.

word stack description
task-init ( xt rs ds task -- ) initialize a task structure. xt = word to execute within task. rs = return stack size. ds = data stack size. task = address of task structure.
task-queue ( a -- ) add a task to the round robin queue.
pause ( -- ) yield to other tasks.
me ( -- a ) fetch task pointer.
single ( -- ) stop all tasks except the interpreter.