Io module

lock

procedureextensionexperimentalSource

Takes the lock, waiting for whoever holds it. Pair it with unlock.

Example↗
Io :: #import "Extensions/Io";

Io.io_run(() {
    mutex: Io.Fiber_Mutex;

    assert(Io.lock(*mutex) == .NONE);
    Io.sleep(1);               // safe to wait while holding it
    Io.unlock(*mutex);
});
lock :: (mutex: *Fiber_Mutex) -> Io_Error

Parameters

mutex: *Fiber_Mutex

Returns

See also