Skip to main content

Module lifecycle

Module lifecycle 

Source
Expand description

Task lifecycle: exit, join, stop (plan.md §5).

A preemptive task whose entry returns lands in rivet_task_exit_core (the arch trampoline jumps there): the return value (≤ 8 bytes, carried in a0/a1 — larger returns need the hidden sret pointer which the trampoline cannot provide, so sizes > 8 are rejected at spawn) is stored type-erased in the TCB, the task is marked exited, and its joiner (if any) is woken. TaskHandle::join blocks until then and recovers the value, or reports JoinError::Faulted when the task was isolated by the fault policy (plan.md §3.4), or JoinError::Stale when the handle’s generation no longer matches (the slot was recycled).

Enums§

JoinError
Errors from super::TaskHandle::join.

Functions§

join_task
Implementation of super::TaskHandle::join.
rivet_task_exit_core
Arch trampoline target: the task’s entry returned; val_lo/val_hi carry the return value (or, for >8-byte results, val_lo is a pointer into this task’s own stack). Stores the result, marks the task exited, wakes its joiner, and parks forever.
should_stop
Cooperative cancellation (plan.md §5.4): poll this from the task’s main loop; returns true once super::TaskHandle::request_stop was called on the current task.