Await.RwlockSourceCreates a reader-writer lock with a fresh existential key type.
Like create. Useful in module definitions, where GADTs cannot be unpacked.
val with_write :
'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_write await t ~f acquires t for writing, runs f within the associated capsule (providing it access to the capsule), then releases t. If t is locked, with_write uses await to wait until it is unlocked.
val with_write_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_write_or_cancel await c t ~f is Completed (with_write await t ~f) if c is not canceled, otherwise it is Canceled.
val with_read :
'k 'a ('b : value_or_null). Await_kernel.Await.t @ local ->
'k t ->
f:
('k Await_capsule__.Import.Capsule.Access.t @ shared ->
'a @ portable contended) @ local once portable ->
'a @ portable contendedwith_read await t ~f acquires t for reading, runs f with shared access to the associated capsule, then releases t. If t is locked for writing, with_read uses await to wait until it is unlocked.
val with_read_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 @ shared ->
'a @ portable contended) @ local once portable ->
'a Await_kernel.Or_canceled.t @ portable contendedwith_read_or_cancel await c t ~f is Completed (with_read await t ~f) if c is not canceled, otherwise it is Canceled.
Functions that poison or freeze the lock if the provided callback raises an exception.