Module sync/mutex

sync/mutex

Mutual exclusion lock primitives.

Phase D (THREAD_SAFETY): Mutex parameterized over the protected data. Access is granted via with_lock(closure) — the closure receives a ref(v): T that is second-class (cannot escape the closure scope). The private __MutexUnlocker handles unlock on both normal return and unwind via its Drop.

Types

__YO_THREAD_SYNC_TYPE

Trait Implementations

mutex_t newtype
mutex_t

Low-level mutex (manual lifetime via destroy).

Fields

NameTypeDescription
mutex__YO_THREAD_SYNC_TYPE
impl(mutex_t, ...)
new : (mutex_t) fn() -> mutex_t

Returns: mutex_t

lock : (mutex_t) fn(self : mutex_t) -> unit

Parameters

NameTypeNotes
selfmutex_t

Returns: unit

unlock : (mutex_t) fn(self : mutex_t) -> unit

Parameters

NameTypeNotes
selfmutex_t

Returns: unit

destroy : (mutex_t) fn(self : mutex_t) -> unit

Parameters

NameTypeNotes
selfmutex_t

Returns: unit

Mutex type-function
fn(comptime(T) : Type) -> (comptime(fn_return_yofd20e00d_id_92) : Type)

Type Parameters

NameTypeNotes
TTypecomptime

Trait Implementations

impl(forall(T : Type), where(T <: Send), Mutex(T), ...)
new : (fn(value : T) -> Self)

Returns: Self

with_lock : ( fn( forall(R : Type), self : Self, body : Impl(Fn(ref(v) : T) -> R) ) -> R )

Returns: R

_raw_lock : (fn(self : Self) -> unit)

Returns: unit

_raw_unlock : (fn(self : Self) -> unit)

Returns: unit

_raw_handle_ptr : (fn(ref(self) : Self) -> *(__YO_THREAD_SYNC_TYPE))

Returns: *(__YO_THREAD_SYNC_TYPE)

impl(forall(T : Type), where(T <: Send), Mutex(T), Dispose(...))
dispose : (fn(self : Self) -> unit)

Returns: unit

__MutexUnlocker type-function
fn(comptime(T) : Type) -> (comptime(fn_return_yofd20e00d_id_125) : Type)

Type Parameters

NameTypeNotes
TTypecomptime

Trait Implementations

impl(forall(T : Type), where(T <: Send), __MutexUnlocker(T), Dispose(...))
dispose : (fn(self : Self) -> unit)

Returns: unit