Synchronisation and cancellation primitives. All worker-safe.

Module Returns Deps Description
abort {timeout, any, wait, race, throwIfAborted, error} none AbortController helpers
mutex {create} none Async binary lock (FIFO)
semaphore {create} none Counting semaphore with N permits
channel {create} none Buffered CSP-style channel
atomics object none SharedArrayBuffer + Atomics helpers (cross-worker)
cancellable {create, race, all, pool} abort Cancellable tasks with cleanup hooks
tokenBucket {create} none Token bucket rate limiter

Common pattern

const abort = runtime.resolve('abort');

// Timeout
const { signal } = abort.timeout(5000);
await fetch(url, { signal });

// Combine signals
const combined = abort.any(signal1, signal2);

// Race promise vs cancellation
const result = await abort.race(fetchData(), signal);