AtomicInt

class AtomicInt(value_: Int)(source)

Atomic values and freezing: atomics AtomicInt, AtomicLong, AtomicNativePtr and AtomicReference are unique types with regard to freezing. Namely, they provide mutating operations, while can participate in frozen subgraphs. So shared frozen objects can have fields of atomic types.

Since Kotlin

1.3

Constructors

Link copied to clipboard
constructor(value_: Int)

Properties

Link copied to clipboard
var value: Int

The value being held by this class.

Since Kotlin 1.3

Functions

Link copied to clipboard
external fun addAndGet(delta: Int): Int

Increments the value by delta and returns the new value.

Since Kotlin 1.3
Link copied to clipboard
external fun compareAndSet(expected: Int, new: Int): Boolean

Compares value with expected and replaces it with new value if values matches.

Since Kotlin 1.3
Link copied to clipboard
external fun compareAndSwap(expected: Int, new: Int): Int

Compares value with expected and replaces it with new value if values matches.

Since Kotlin 1.3
Link copied to clipboard
fun decrement()

Decrements value by one.

Since Kotlin 1.3
Link copied to clipboard
fun increment()

Increments value by one.

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

Returns the string representation of this object.

Since Kotlin 1.3