This sequential implementation is provided in the interest of compatibility: when people will start writing code to run on Multicore, it would be nice if their use of Atomic was backward-compatible with older versions of OCaml without having to import additional compatibility layers.
since 4.12
type!'a t
An atomic (mutable) reference to a value of type 'a.
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.