Skip to main content
Concurrency boundaries are ownership boundaries. A spawned task may outlive the current line of code, so values captured by that task must be owned and safe to send.

Owned Inputs

Pass owned values into spawned tasks.
The child owns its input. The parent observes the task through the handle.

Shared Read Access

Use explicit synchronization primitives for values shared across tasks.
Shared[T] is for concurrent read access. Mutable shared state uses explicit lock types from sifr.sync.

Mutable Borrows And Await

Mutable borrows must end before an await. This shape is rejected because the mutable borrow remains live when the function reaches await:
End the mutation before awaiting by moving the mutation into a synchronous helper.
Lock guards, borrowed references, and mutable borrows cannot cross task or await boundaries. Move owned values, clone when copying is intended, or use sifr.sync primitives.

Next Steps

Parallel Work

Apply the same ownership rules to CPU worker boundaries.

Ownership and Mutability

Review mut, own, own mut, and borrowed-value escape rules.