fun compareAndSet(expected: Long, new: Long): Boolean
(source)
Compares value with expected and replaces it with new value if values matches.
Parameters
expected
- the expected value
new
- the new value
Return true if successful, false if state is unchanged