123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103(** A ['a Atomic_lazy.t] is a thread-safe version of the built-in [lazy_t], i.e. it both
is sound with respect to modes and is safe to force from multiple threads. The
thread-safety is relatively straight-forward, implemented using an atomic reference
around the state of the [Atomic_lazy.t] and using blocking when multiple threads force
the same lazy simultaneously. Making the implementation both efficient *and* sound
with respect to modes, however, is more complicated.
The implementation of [Atomic_lazy] in this library is optimized for performance, but
requires magic to expose a safe and expressive interface into it. The safety of the
interface alone is justified by a non-magic implementation in the tests of this
library, which implements [S_any] below using a slightly less efficient
representation. *)(*_ NOTE: Do *not* rearrange the signatures below without considering how it affects the
magic in [atomic_lazy.ml]. *)(** The nonportable interface to [Atomic_lazy]. *)moduletypeS_any_nonportable=sig@@portabletype('a:value_or_null)t:anyvalfrom_val:('a:value_or_null).'a->'atvalfrom_fun:('a:value_or_null).(unit->'a)@once->'atvalfrom_fun_fixed:('a:value_or_null).('at->'a)@once->'atvalforce:('a:value_or_null).'at@local->'avalis_val:('a:value_or_null).'at->boolvalpeek:('a:value).'at->'aOr_null_shim.tvalpeek_opt:('a:value_or_null).'at->'aoptionvalglobalize:('a:value_or_null)('b:value_or_null).'b->'at@local->'atend(** The portable interface to [Atomic_lazy]. The behavior of the functions is identical to
that of their corresponding function in [S_any_nonportable], and the naming scheme is
written to align with what is expected by [ppx_template]. *)moduletypeS_any_portable=sig@@portabletype('a:value_or_null)t:anyvalfrom_val__portable:('a:value_or_null).'a@portable->'at@portablevalfrom_fun__portable:('a:value_or_null).(unit->'a@portable)@onceportable->'at@portablevalfrom_fun_fixed__portable:('a:value_or_null).('at@contendedportable->'a@portable)@onceportable->'at@portablevalforce__contended:('a:value_or_null).'at@contendedlocalportable->'a@contendedvalis_val__contended:('a:value_or_null).'at@contendedportable->boolvalpeek__contended:('a:value).'at@contendedportable->'aOr_null_shim.t@contendedvalpeek_opt__contended:('a:value_or_null).'at@contendedportable->'aoption@contendedvalglobalize__contended:('a:value_or_null)('b:value_or_null).'b->'at@contendedlocalportable->'at@contendedportableend(** The nonportable portion of [Atomic_lazy], specialized to [value] layout. *)moduletypeS_nonportable=sig@@portabletype('a:value_or_null)tincludeS_any_nonportablewithtype('a:value_or_null)t:='atend(** The portable portion of [Atomic_lazy], specialized to [value] layout. *)moduletypeS_portable=sig@@portabletype('a:value_or_null)tincludeS_any_portablewithtype('a:value_or_null)t:='atend(** The nonportable portion of [Atomic_lazy], specialized to [value] layout with a
covariant type parameter. *)moduletypeS_nonportable_covariant=sig@@portabletype(+'a:value_or_null)tincludeS_nonportablewithtype('a:value_or_null)t:='atend(** The full interface to [Atomic_lazy], with no kind/variance restrictions on the type.
Specifically used in tests to show soundness of mode annotations. *)moduletypeS_any=sig@@portabletype('a:value_or_null)t:anyincludeS_any_nonportablewithtype('a:value_or_null)t:='atincludeS_any_portablewithtype('a:value_or_null)t:='atend(** The full interface to [Atomic_lazy], specialized to [value] layout with a covariant
type parameter. This is the actual exposed interface of [Atomic_lazy]. *)moduletypeS=sig@@portabletype(+'a:value_or_null)tincludeS_anywithtype('a:value_or_null)t:='atend