AtomicIntArray

Native
1.9
@ExperimentalStdlibApi class AtomicIntArray
(source)

An IntArray in which elements are always updated atomically. For additional details about atomicity guarantees for reads and writes see kotlin.concurrent.Volatile.

Constructors

Native
1.3

<init>

Creates a new AtomicIntArray of the given size, with all elements initialized to zero.

AtomicIntArray(size: Int)

Properties

Native
1.3

length

Returns the number of elements in the array.

val length: Int

Functions

Native
1.3

addAndGet

Atomically adds the given delta to the element at the given index and returns the new value of the element.

fun addAndGet(index: Int, delta: Int): Int
Native
1.3

compareAndExchange

Atomically sets the value of the element at the given index to the new value if the current value equals the expected value and returns the old value of the element in any case.

fun compareAndExchange(
    index: Int,
    expectedValue: Int,
    newValue: Int
): Int
Native
1.3

compareAndSet

Atomically sets the value of the element at the given index to the new value if the current value equals the expected value. Returns true if the operation was successful and false only if the current value of the element was not equal to the expected value.

fun compareAndSet(
    index: Int,
    expectedValue: Int,
    newValue: Int
): Boolean
Native
1.3

decrementAndGet

Atomically decrements the element at the given index by one and returns the new value of the element.

fun decrementAndGet(index: Int): Int
Native
1.3

get

Atomically gets the value of the element at the given index.

operator fun get(index: Int): Int
Native
1.3

getAndAdd

Atomically adds the given delta to the element at the given index and returns the old value of the element.

fun getAndAdd(index: Int, delta: Int): Int
Native
1.3

getAndDecrement

Atomically decrements the element at the given index by one and returns the old value of the element.

fun getAndDecrement(index: Int): Int
Native
1.3

getAndIncrement

Atomically increments the element at the given index by one and returns the old value of the element.

fun getAndIncrement(index: Int): Int
Native
1.3

getAndSet

Atomically sets the value of the element at the given index to the new value and returns the old value of the element.

fun getAndSet(index: Int, newValue: Int): Int
Native
1.3

incrementAndGet

Atomically increments the element at the given index by one and returns the new value of the element.

fun incrementAndGet(index: Int): Int
Native
1.3

set

Atomically sets the value of the element at the given index to the new value.

operator fun set(index: Int, newValue: Int)
Native
1.3

toString

Returns the string representation of the underlying IntArray.

fun toString(): String