Direct-style concurrency (ADR 0067): every operation checks its source, acts when ready, and waits when not. Core's blocking fallback waits the worker; a cooperative scheduler binds the resumption and waits only the task. Channel endpoint lifecycle and the runtime's queue, registration, wake, and deadline layers remain unchanged.
API Reference
Structs
struct Sender<T>
A clonable sending endpoint for an unbounded, multi-producer channel.
struct Receiver<T>
The single receiving endpoint shared by bounded and unbounded channels.
struct BoundedSender<T>
A clonable producer endpoint with atomic capacity reservation.
Enums
enum Either<L, R>
Identifies which of two differently typed operations produced a value.
Functions
func run_blocking<A, T>(consume arg: A, consume body: (consume A) '[io, alloc, yield, panic, wait] -> T) -> T
Install the full set of root fallbacks — the same rows core's _with_host gives the program entry — and run body under them with arg passed through. A runtime-spawned closure must be self-contained across the boundary, and a closure cannot capture owned values, so state arrives as an argument.
func parallel_run<A, T>(
consume jobs: [A],
worker: (consume A) '[io, alloc, yield, panic, wait] -> T
) -> [T] where A: Send && T: Send
Run every job on its own parallel worker and return the outputs in argument order (ADR 0058). Structured: every worker completes before this returns, and no handle escapes. Transfer capabilities gate the boundary: jobs move to workers and outputs move back. Each worker gets its own standard host fallbacks; user-defined effects still need handlers inside the worker.
func channel<T>() -> (Sender<T>, Receiver<T>) where T: Send
Creates an unbounded FIFO transfer channel.
func channel_bounded<T>(capacity: Int) -> (BoundedSender<T>, Receiver<T>) where T: Send
Creates a FIFO transfer channel with producer backpressure.
func sleep(_ duration: Duration) -> ()
Suspends until at least duration of monotonic time has elapsed.
func select_recv<T, U>(a: &Receiver<T>, b: &Receiver<U>) -> Either<T?, U?>
Race two receivers: the first ready side wins, ties go left, and a closed channel counts as ready (its receive is none). The losing side's value stays queued for a later receive.