compareAndExchange

fun compareAndExchange(expectedValue: NativePtr, newValue: NativePtr): NativePtr(source)

Atomically stores the given new value into this AtomicNativePtr if the current value equals the expected value and returns the old value in any case.

Comparison of values is done by value.

Since Kotlin

2.1