compareAndSet

fun compareAndSet(expectedValue: NativePtr, newValue: NativePtr): Boolean(source)

Atomically stores the given new value into this AtomicNativePtr if the current value equals the expected value, returns true if the operation was successful and false only if the current value was not equal to the expected value.

This operation has so-called strong semantics, meaning that it returns false if and only if current and expected values are not equal.

Comparison of values is done by value.

Since Kotlin

2.1