atomic_cas() function
Atomic compare-and-set. This routine performs an atomic compare-and-set on @a target. If the current value of @a target equals @a old_value, @a target is set to @a new_value. If the current value of @a target does not equal @a old_value, @a target is left unchanged.
Arguments
target
Address of atomic variable.
old_value
Original value to compare against.
new_value
New value to store.
Return value
1 if @a new_value is written, 0 otherwise.