jon.recoil.org

Module Extended.FrozenSource

Sourcetype 'a t : (value mod contended forkable many portable unyielding) with 'a portable @@ contended portable

A frozen value in its own capsule. Nobody may write to the contained 'a without synchronization, so everyone may read from it.

This type is useful for locally initializing some mutable data structure, then permanently freezing it to give read access to multiple threads.

Note that types which are sync_data, such as atomic references, may still be mutated when stored in a Capsule.Frozen.t.

Sourceval create : (unit -> 'a @ portable) @ local once portable -> 'a t

create f runs f within a fresh capsule, and creates a Capsule.Frozen.t containing the result.

Sourceval unwrap : 'a t -> 'a @ portable shared

unwrap t takes a frozen capsule t and returns the underlying value at shared.