Rwlock.PoisoningSourceFunctions that poison or freeze the lock if the provided callback raises an exception.
val with_write :
'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_write parallel t ~f acquires t for writing, 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_write_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_write_or_cancel parallel c t ~f is Completed (with_write 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.
val with_read :
'k 'a ('b : value_or_null). Parallel_kernel.t @ local ->
'k t ->
f:
(Parallel_kernel.t @ local ->
('k Await.Capsule.Access.t @ shared ->
'a @ portable contended) @ local once) @ local once portable unyielding ->
'a @ portable contendedwith_read parallel t ~f acquires t for reading, runs f within the associated capsule with access to parallel for doing parallel work, then releases t.
If f raises, t will be frozen, meaning all subsequent attempts to acquire it for writing will raise.
val with_read_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 @ shared ->
'a @ portable contended) @ local once) @ local once portable unyielding ->
'a Await.Or_canceled.t @ portable contendedwith_read_or_cancel parallel c t ~f is Completed (with_read parallel t ~f) if c is not canceled, otherwise it is Canceled.
If f raises, t will be frozen, meaning all subsequent attempts to acquire it for writing will raise.