compareAndSet

Native
1.3
fun compareAndSet(expected: Long, new: Long): Boolean

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