module AtomicStampedReference:sig..end
type 'a t
WARNING: physical comparison is used by the container.
CONSEQUENCE 1: should be used with caution to store int32,
int64, nativeint, or double values as they are wrapped into
blocks. Hence, comparisons are done on block addresses rather than
on wrapped values.
CONSEQUENCE 2: as OCaml-Java uses boxed values for int values,
the container should not be used to store int values.
Any other type can be safely stored (caching of some int values
ensure that sum types are correctly handled).
typestamp =int32
val make : 'a -> stamp -> 'a tval attempt_stamp : 'a t -> 'a -> stamp -> boolattempt_stamp a e s sets the stamp to s if the current value is
e. Returns whether the value of a was equal to e.val compare_and_set : 'a t ->
'a ->
'a -> stamp -> stamp -> boolcompare_and_set a er ur es us atomically sets the value of a to
ur and stamp to us if the current value is er and the current
stamp is es. Returns whether the value of a was equal to er and
the stamp was equal to es.val get : 'a t -> 'a * stampval get_reference : 'a t -> 'aval get_stamp : 'a t -> stampval set : 'a t -> 'a -> stamp -> unitset a x s sets the value of a to x, and the stamp to s.val weak_compare_and_set : 'a t ->
'a ->
'a -> stamp -> stamp -> boolcompare_and_set, with a weak semantics: may be
faster on some platforms, but does not provide ordering guarantees.