Performs compare and swap (CAS). Atomically compares if the variable
`atomic' has the value `old_val' and in that case swaps it with the
value `new_val'. Returns TRUE if the old value was same and it was
swapped and FALSE if it differed and was not swapped.