Await.MutexSourceLike create. Useful in module definitions, where GADTs cannot be unpacked.
val with_lock :
'k 'a ('b : value_or_null). Await_kernel.Await.t @ local ->
'k t ->
f:
('k Await_capsule__.Import.Capsule.Access.t -> 'a @ portable contended) @ local once portable ->
'a @ portable contendedwith_lock await t ~f acquires t, runs f within the associated capsule (providing it access to the capsule), then releases t. If t is locked, with_lock uses await to wait until it is unlocked.
val with_lock_or_cancel :
'k 'a ('b : value_or_null). Await_kernel.Await.t @ local ->
Await_kernel.Cancellation.t @ local ->
'k t ->
f:
('k Await_capsule__.Import.Capsule.Access.t -> 'a @ portable contended) @ local once portable ->
'a Await_kernel.Or_canceled.t @ portable contendedwith_lock_or_cancel await c t ~f is Completed (with_lock await t ~f) if c is not canceled, otherwise it is Canceled.
Functions that poison the mutex if the provided callback raises an exception.