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
Native
fun AtomicInt(value_: Int)

Functions

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

Increments the value by delta and returns the new value.

compareAndSet
Link copied to clipboard
Native
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
Native
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
Native
fun decrement()

Decrements value by one.

increment
Link copied to clipboard
Native
fun increment()

Increments value by one.

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

Returns the string representation of this object.

Properties

value
Link copied to clipboard
Native
var value: Int

The value being held by this class.