jon.recoil.org

Module Shared.UncontendedSource

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

Like 'a Scoped.Shared.t, but allows read-only computations to return an uncontended result in the current capsule.

Sourcetype ('a, 'b) f = {
  1. f : 'k. ('a, 'k) t @ local forkable -> ('b, 'k) Capsule_prim__.Prim.Data.Shared.t;
}
Sourceval with_ : 'a @ shared -> ('a, 'b) f @ local once forkable -> 'b

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

The result of f is a Capsule.Data.Shared.t, which can be unwrapped in the current capsule.

Sourceval get : ('a : value mod portable) 'b 'k. ('a, 'k) t @ local -> f:('a @ shared -> 'b) @ local once portable -> ('b, 'k) Capsule_prim__.Prim.Data.Shared.t

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

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

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