Io module

try_lock

procedureextensionexperimentalSource

Takes the lock if it is free, without waiting; returns whether it did.

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

mutex: Io.Fiber_Mutex;
assert(Io.try_lock(*mutex));
assert(!Io.try_lock(*mutex));
Io.unlock(*mutex);
try_lock :: (mutex: *Fiber_Mutex) -> bool

Parameters

mutex: *Fiber_Mutex

Returns

bool

See also