Skip to main content
Sifr treats cancellation as part of structured concurrency. A cancelled child does not keep running in the background, and cleanup runs before cancellation or timeout evidence is observed by the caller.

Timeout

Use task.timeout to bound the runtime of an awaitable operation.
When the timeout expires, the block is cancelled and the caller handles typed timeout evidence.

Cleanup Runs First

Cleanup in finally runs before the timeout is observed outside the block.
This keeps resource cleanup deterministic even when work is cancelled.

Manual Cancellation

Task handles can be cancelled explicitly.
The handle still has one owner and one observation path.

Sibling Cancellation

TaskGroup cancels unfinished siblings when one child fails. Use this for all-or-cancel groups where partial completion should not leak beyond the group.
Do not use task cancellation as a hidden control-flow side channel. Treat timeout and cancellation as typed evidence that the caller must handle.

Next Steps

Ownership Across Tasks

See what values can cross spawn and await boundaries.

Structured Tasks

Review how scopes own and clean up spawned work.