Skip to main content

Module task

Module task 

Source
Expand description

Cancellable owned tasks (SpawnedTask, TaskGroup). Cancellable owned tasks.

SpawnedTask is the canonical owner for a background task that must be cooperatively stopped: it bundles a CancellationToken with the JoinHandle, so every task has explicit ownership, cancellation, and a bounded, drain-then-abort shutdown. TaskGroup owns a set of such tasks and shuts them all down together. This replaces the hand-rolled cancel + handle pairs duplicated across consumers, watchers, and servers.

Structsยง

SpawnedTask
A single background task with cooperative cancellation.
TaskGroup
A set of SpawnedTasks shut down together.