compareAndSet

external fun compareAndSet(expected: Long, new: Long): Boolean(source)

Compares value with expected and replaces it with new value if values matches.

Since Kotlin

1.3

Return

true if successful, false if state is unchanged

Parameters

expected

the expected value

new

the new value