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
type-alias
mutex_t
newtype
mutex_t
Low-level mutex (manual lifetime via destroy).
Fields
| Name | Type | Description |
|---|---|---|
mutex | __YO_THREAD_SYNC_TYPE |
impl(mutex_t, ...)
new : (mutex_t) fn() -> mutex_tReturns: mutex_t
lock : (mutex_t) fn(self : mutex_t) -> unitParameters
| Name | Type | Notes |
|---|---|---|
self | mutex_t |
Returns: unit
unlock : (mutex_t) fn(self : mutex_t) -> unitParameters
| Name | Type | Notes |
|---|---|---|
self | mutex_t |
Returns: unit
destroy : (mutex_t) fn(self : mutex_t) -> unitParameters
| Name | Type | Notes |
|---|---|---|
self | mutex_t |
Returns: unit
Mutex
type-function
fn(comptime(T) : Type) -> (comptime(fn_return_yofd20e00d_id_92) : Type)
Type Parameters
| Name | Type | Notes |
|---|---|---|
T | Type | comptime |
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