FreezableAtomicReference

Native
1.3
@DeprecatedSinceKotlin("1.9") class FreezableAtomicReference<T>
(source)
Deprecated: Use kotlin.concurrent.AtomicReference instead.

Note: this class is useful only with legacy memory manager. Please use AtomicReference instead.

An atomic reference to a Kotlin object. Can be used in concurrent scenarious, but must be frozen first, otherwise behaves as regular box for the value. If frozen, shall be zeroed out once no longer needed. Otherwise memory leak could happen. To detect such leaks kotlin.native.runtime.GC.detectCycles in debug mode could be helpful.

Constructors

Native
1.3

<init>

Note: this class is useful only with legacy memory manager. Please use AtomicReference instead.

FreezableAtomicReference(value_: T)

Properties

Native
1.3

value

The referenced value. Gets the value or sets to the given new value. If the new value is not null, and this is frozen - it must be frozen or permanent object.

var value: T

Functions

Native
1.3

compareAndSet

Atomically sets the value to the given new value if the current value equals the expected value and returns true if operation was successful.

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

compareAndSwap

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 compareAndSwap(expected: T, newValue: T): T
Native
1.3

toString

Returns the string representation of this object.

fun toString(): String