Module Rwlock.PoisoningSource

Functions that poison or freeze the lock if the provided callback raises an exception.

Sourceval 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 contended

with_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.

  • raises Poisoned

    if t cannot be acquired because it is poisoned.

  • raises Frozen

    if t cannot be acquired for writing because it is frozen.

Sourceval 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 contended

with_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.

Sourceval 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 contended

with_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.

  • raises Poisoned

    if t cannot be acquired because it is poisoned.

Sourceval 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 contended

with_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.