Stdlib.AtomicSourceAtomic references.
See 'Memory model: The hard bits' chapter in the manual.
An atomic (mutable) reference to a value of type 'a.
Set a new value for the atomic reference, and return the current value.
compare_and_set r seen v sets the new value of r to v only if its current value is physically equal to seen -- the comparison and the set occur atomically. Returns true if the comparison succeeded (so the set happened) and false otherwise.
fetch_and_add r n atomically increments the value of r by n, and returns the current value (before the increment).