AtomicNativePtr

Native
1.9
class AtomicNativePtr
(source)

A kotlinx.cinterop.NativePtr value that is always updated atomically. For additional details about atomicity guarantees for reads and writes see kotlin.concurrent.Volatile.

kotlinx.cinterop.NativePtr is a value type, hence it is stored in AtomicNativePtr without boxing and compareAndSet, compareAndExchange operations perform comparison by value.

Constructors

Native
1.3

<init>

A kotlinx.cinterop.NativePtr value that is always updated atomically. For additional details about atomicity guarantees for reads and writes see kotlin.concurrent.Volatile.

AtomicNativePtr(value: NativePtr)

Properties

Native
1.3

value

var value: NativePtr

Functions

Native
1.3

compareAndExchange

Atomically sets the value to the given new value if the current value equals the expected value and returns the old value in any case.

fun compareAndExchange(
    expected: NativePtr,
    newValue: NativePtr
): NativePtr
Native
1.3

compareAndSet

Atomically sets the value to the given new value 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.

fun compareAndSet(
    expected: NativePtr,
    newValue: NativePtr
): Boolean
Native
1.3

getAndSet

Atomically sets the value to the given new value and returns the old value.

fun getAndSet(newValue: NativePtr): NativePtr
Native
1.3

toString

Returns the string representation of the current value.

fun toString(): String