jon.recoil.org

Module Scoped.SharedSource

Sourcetype ('a, 'k) inner = #{
  1. data : ('a Basement.Modes.shared, 'k) Data.t;
  2. password : 'k Capsule_prim__.Prim.Password.Shared.t;
}
Sourcetype 'a t =
  1. | P : ('a, 'k) inner -> 'a t

An encapsulated value that may be read for the duration of the current region.

A value of type 'a Scoped.Shared.t provides shared access to the underlying 'a over a local scope. A forkable 'a Scoped.Shared.t can be captured by functions that run from other capsules.

Sourceval with_ : ('a : value mod portable) 'b. 'a @ shared -> f:('a t @ local forkable -> 'b) @ local once forkable -> 'b

with_ a ~f calls f with a local forkable Shared.t representing local read-only access to a, which is readable in the current capsule.

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

get t ~f computes a value using data accessible via t.

Sourceval iter : ('a : value mod portable). 'a t @ local -> f:('a @ shared -> unit) @ local once portable -> unit

Like get, but for for functions that return unit.

Sourceval map : ('a : value mod portable) ('b : value mod portable). 'a t @ local -> f:('a @ shared -> 'b @ shared) @ local once portable -> 'b t @ local

Construct a new t by mapping a function over the referenced value.

Sourcemodule Uncontended : sig ... end