Module Parallel_capsule.With_rwlockSource

Sourceval with_write : 'a ('b : value_or_null). Parallel_kernel.t @ local -> 'a t -> f: (Parallel_kernel.t @ local -> ('a -> 'b @ portable contended) @ local once) @ local once portable unyielding -> 'b @ portable contended

with_write parallel t ~f locks the reader-writer lock associated with t for writing and calls f on the protected value with access to parallel for doing parallel work, returning the result.

Sourceval with_write_or_cancel : 'a ('b : value_or_null). Parallel_kernel.t @ local -> Await.Cancellation.t @ local -> 'a t -> f: (Parallel_kernel.t @ local -> ('a -> 'b @ portable contended) @ local once) @ local once portable unyielding -> 'b 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.

Sourceval with_scoped : 'a ('b : value_or_null). Parallel_kernel.t @ local -> 'a t -> f: (Parallel_kernel.t @ local -> ('a Await.Capsule.Scoped.t @ local -> 'b) @ local once) @ local once unyielding -> 'b

with_scoped t ~f locks the reader-writer lock associated with t for writing and calls f with a Scoped.t for the protected data, returning the result.

Since the provided callback does not have to be portable, this is useful when you need to acquire two mutexes for different capsules at the same time and move data between them. See With_mutex.with_scoped for an example.

Sourceval with_scoped_or_cancel : 'a ('b : value_or_null). Parallel_kernel.t @ local -> Await.Cancellation.t @ local -> 'a t -> f: (Parallel_kernel.t @ local -> ('a Await.Capsule.Scoped.t @ local -> 'b) @ local once) @ local once unyielding -> 'b Await.Or_canceled.t

with_scoped_or_cancel parallel c t ~f is Completed (with_scoped parallel t ~f) if c is not canceled, otherwise it is Canceled.

Sourceval with_read : ('a : value mod portable) ('b : value_or_null). Parallel_kernel.t @ local -> 'a t -> f: (Parallel_kernel.t @ local -> ('a @ shared -> 'b @ portable contended) @ local once) @ local once portable unyielding -> 'b @ portable contended

with_read parallel t ~f locks the reader-writer lock associated with t for reading and calls f on the protected value with access to parallel for doing parallel work, returning the result.

Sourceval with_read_or_cancel : ('a : value mod portable) ('b : value_or_null). Parallel_kernel.t @ local -> Await.Cancellation.t @ local -> 'a t -> f: (Parallel_kernel.t @ local -> ('a @ shared -> 'b @ portable contended) @ local once) @ local once portable unyielding -> 'b 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.

Sourceval with_scoped_shared : ('a : value mod portable) ('b : value_or_null). Parallel_kernel.t @ local -> 'a t -> f: (Parallel_kernel.t @ local -> ('a Await.Capsule.Scoped.Shared.t @ local forkable -> 'b) @ local once) @ local once unyielding -> 'b

with_scoped_shared t ~f locks the reader-writer lock associated with t for reading and calls f with a Scoped.Shared.t for the protected data, returning the result.

with_scope_shared is similar to with_scoped, but hands out a Capsule.Scoped.Shared.t

Sourceval with_scoped_shared_or_cancel : ('a : value mod portable) ('b : value_or_null). Parallel_kernel.t @ local -> Await.Cancellation.t @ local -> 'a t -> f: (Parallel_kernel.t @ local -> ('a Await.Capsule.Scoped.Shared.t @ local forkable -> 'b) @ local once) @ local once unyielding -> 'b Await.Or_canceled.t

with_scoped_shared_or_cancel parallel c t ~f is Completed (with_scoped_shared parallel t ~f) if c is not canceled, otherwise it is Canceled.

Sourcemodule Poisoning : sig ... end

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