Module AtomicInt64

module AtomicInt64: sig .. end
Atomic containers for int64 values.

type t = java'util'concurrent'atomic'AtomicLong java_instance
The type of atomic containers for int64 values.
 
val make : int64 -> t
Returns a new container holding the passed value.
 
val add_and_get : t -> int64 -> int64
add_and_get a d atomically adds d to the current value, and returns the new value.
 
val compare_and_set : t -> int64 -> int64 -> bool
compare_and_set a e u atomically sets the value of a to u if the current value is e. Returns whether the value of a was equal to e.
 
val decrement_and_get : t -> int64
Atomically decrements the current value, and returns the new value.
 
val get : t -> int64
Returns the current value.
 
val get_and_add : t -> int64 -> int64
get_and_add a d atomically adds d to the current value, and returns the previous value.
 
val get_and_decrement : t -> int64
Atomically decrements the current value, and returns the previous value.
 
val get_and_increment : t -> int64
Atomically increments the current value, and returns the previous value.
 
val get_and_set : t -> int64 -> int64
get_and_set a x atomically sets the value of a to x, and returns the previous value.
 
val increment_and_get : t -> int64
Atomically increments the current value, and returns the new value.
 
val lazy_set : t -> int64 -> unit
lazy_set a x eventually sets the value of a to x.
 
val set : t -> int64 -> unit
set a x sets the value of a to x.
 
val weak_compare_and_set : t -> int64 -> int64 -> bool
Similar to AtomicInt64.compare_and_set, with a weak semantics: may be faster on some platforms, but does not provide ordering guarantees.
 

Null value

 
val null : t
The null value.
 
val is_null : t -> bool
is_null obj returns true iff obj is equal to null.
 
val is_not_null : t -> bool
is_not_null obj returns false iff obj is equal to null.
 

Miscellaneous

 
val wrap : t -> t option
wrap obj wraps the reference obj into an option type:
  • Some x if obj is not null;
  • None if obj is null.

 
val unwrap : t option -> t
unwrap obj unwraps the option obj into a bare reference:
  • Some x is mapped to x;
  • None is mapped to null.