AtomicReference

actual class AtomicReference<T>(var value: T)(source)

An object reference that is always updated atomically.

Since Kotlin

1.9

Constructors

Link copied to clipboard
actual constructor(value: T)

Properties

Link copied to clipboard
actual var value: T
Since Kotlin 1.9

Functions

Link copied to clipboard
actual fun compareAndExchange(expected: T, newValue: T): T

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.

Since Kotlin 1.9
Link copied to clipboard
actual fun compareAndSet(expected: T, newValue: T): Boolean

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.

Since Kotlin 1.9
Link copied to clipboard
fun getAndSet(newValue: T): T

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

Since Kotlin 1.9
Link copied to clipboard
open override fun toString(): String

Returns the string representation of the current value.

Since Kotlin 1.9