compareAndSet

Native
1.3
fun compareAndSet(expected: Int, new: Int): 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