Mutex.PoisoningSourceFunctions that poison the mutex if the provided callback raises an exception.
val with_lock :
'k 'a ('b : value_or_null). Parallel_kernel.t @ local ->
'k t ->
f:
(Parallel_kernel.t @ local ->
('k Await.Capsule.Access.t ->
'a @ portable contended) @ local once) @ local once portable unyielding ->
'a @ portable contendedwith_lock parallel t ~f acquires the mutex t, runs f within the associated capsule with access to parallel for doing parallel work, then releases t.
If f raises, t will be poisoned, meaning all subsequent attempts to acquire it will raise.
val with_lock_or_cancel :
'k 'a ('b : value_or_null). Parallel_kernel.t @ local ->
Await.Cancellation.t @ local ->
'k t ->
f:
(Parallel_kernel.t @ local ->
('k Await.Capsule.Access.t ->
'a @ portable contended) @ local once) @ local once portable unyielding ->
'a Await.Or_canceled.t @ portable contendedwith_lock_or_cancel parallel c t ~f is Completed (with_lock parallel t ~f) if c is not canceled, otherwise it is Canceled.
If f raises, t will be poisoned, meaning all subsequent attempts to acquire it will raise.