Skip to main content

Module task

Module task 

Source
Expand description

Tasks — the unit the scheduler multiplexes.

A task is a small state machine: each poll advances it until it next wants to block (on a channel, a select, or a timer), yield, spawn, or exit. The scheduler drives poll, parks the task on blocking steps, and resumes it (delivering any value) when the block clears. The interpreter and VM each implement Task over their own continuation; the toy tasks in the tests implement it by hand.

Structs§

TaskCtx
Per-poll context: what the task was resumed with.
TaskId
A scheduler-assigned task handle.

Enums§

SelectArm
One arm of a Select (Await the first of:).
TaskStep
What a task asks the scheduler to do after a poll.

Traits§

Task
A schedulable unit of work. 't ties any spawned children to the lifetime of borrowed data the task closes over (e.g. the interpreter’s borrowed AST).