AtomicInt

class AtomicInt(value_: Int)

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.

Constructors

AtomicInt
Link copied to clipboard
fun AtomicInt(value_: Int)

Functions

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

Increments the value by delta and returns the new value.

compareAndSet
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.

compareAndSwap
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.

decrement
Link copied to clipboard
fun decrement()

Decrements value by one.

increment
Link copied to clipboard
fun increment()

Increments value by one.

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

Returns the string representation of this object.

Properties

value
Link copied to clipboard
var value: Int

The value being held by this class.