API Reference › Sync › Sync.mutex
method

Sync.mutex

Sync.mutex() -> int

Create a cooperative lock.

Creates a mutex handle for guarding a critical section. On the deterministic single-threaded runtime it never blocks — pair Sync.lock / Sync.unlock around the section, or probe with Sync.try_lock.

Example

let m = Sync.mutex()
← All symbols