AtomicIntArray

An array of ints in which elements may be updated atomically.

Platform-specific implementation details:

When targeting the Native backend, AtomicIntArray stores an IntArray and atomically updates it's elements. For additional details about atomicity guarantees for reads and writes see kotlin.concurrent.Volatile.

When targeting the JVM, instances of AtomicIntArray are represented by java.util.concurrent.atomic.AtomicIntegerArray. For details about guarantees of volatile accesses and updates of atomics refer to The Java Language Specification (17.4 Memory Model).

For JS and Wasm AtomicIntArray is implemented trivially and is not thread-safe since these platforms do not support multi-threading.

Since Kotlin

2.1

An array of ints in which elements may be updated atomically.

Since the JS platform does not support multi-threading, the implementation is trivial and has no atomic synchronizations.

Since Kotlin

2.1

An array of ints in which elements may be updated atomically.

Instances of AtomicIntArray are represented by java.util.concurrent.atomic.AtomicIntegerArray and provide the the same atomicity guarantees.

Since Kotlin

2.1

An array of ints in which elements may be updated atomically.

Read operation loadAt has the same memory effects as reading a Volatile property; Write operation storeAt has the same memory effects as writing a Volatile property; Read-modify-write operations, like exchangeAt, compareAndSetAt, compareAndExchangeAt, fetchAndAddAt, addAndFetchAt, have the same memory effects as reading and writing a Volatile property.

For additional details about atomicity guarantees for reads and writes see kotlin.concurrent.Volatile.

Since Kotlin

2.1

An array of ints in which elements may be updated atomically.

Since the Wasm platform does not support multi-threading, the implementation is trivial and has no atomic synchronizations.

Since Kotlin

2.1

An array of ints in which elements may be updated atomically.

Since the Wasm platform does not support multi-threading, the implementation is trivial and has no atomic synchronizations.

Since Kotlin

2.1

Constructors

Link copied to clipboard
expect constructor(size: Int)

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

expect constructor(array: IntArray)

Creates a new AtomicIntArray filled with elements of the given array.

actual constructor(size: Int)

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

actual constructor(array: IntArray)

Creates a new AtomicIntArray filled with elements of the given array.

actual constructor(size: Int)

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

actual constructor(array: IntArray)

Creates a new AtomicIntArray filled with elements of the given array.

actual constructor(size: Int)

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

actual constructor(array: IntArray)

Creates a new AtomicIntArray filled with elements of the given array.

actual constructor(size: Int)

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

actual constructor(array: IntArray)

Creates a new AtomicIntArray filled with elements of the given array.

actual constructor(size: Int)

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

actual constructor(array: IntArray)

Creates a new AtomicIntArray filled with elements of the given array.

Properties

Link copied to clipboard
val length: Int

Returns the number of elements in the array.

Since Kotlin 2.1
Link copied to clipboard
expect val size: Int

Returns the number of elements in the array.

Since Kotlin 2.1
actual val size: Int

Returns the number of elements in the array.

Since Kotlin 2.1
actual val size: Int

Returns the number of elements in the array.

Since Kotlin 2.1
actual val size: Int

Returns the number of elements in the array.

Since Kotlin 2.1
actual val size: Int

Returns the number of elements in the array.

Since Kotlin 2.1
actual val size: Int

Returns the number of elements in the array.

Since Kotlin 2.1

Functions

Link copied to clipboard
expect fun addAndFetchAt(index: Int, delta: Int): Int

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

Since Kotlin 2.1
actual fun addAndFetchAt(index: Int, delta: Int): Int

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

Since Kotlin 2.1
actual fun addAndFetchAt(index: Int, delta: Int): Int

Atomically adds the given delta the element of this AtomicIntArray at the given index by and returns the new value of the element.

Since Kotlin 2.1
actual fun addAndFetchAt(index: Int, delta: Int): Int

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

Since Kotlin 2.1
actual fun addAndFetchAt(index: Int, delta: Int): Int

Atomically adds the given delta the element of this AtomicIntArray at the given index by and returns the new value of the element.

Since Kotlin 2.1
actual fun addAndFetchAt(index: Int, delta: Int): Int

Atomically adds the given delta the element of this AtomicIntArray at the given index by and returns the new value of the element.

Since Kotlin 2.1
Link copied to clipboard
fun addAndGet(index: Int, delta: Int): Int

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

Since Kotlin 2.1
Link copied to clipboard
fun compareAndExchange(index: Int, expectedValue: Int, newValue: Int): Int

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.

Since Kotlin 2.1
Link copied to clipboard
expect fun compareAndExchangeAt(index: Int, expectedValue: Int, newValue: Int): Int

Atomically stores the new value into the element of this AtomicIntArray at the given index if the current value equals the expected value and returns the old value of the element in any case.

Since Kotlin 2.1
actual fun compareAndExchangeAt(index: Int, expectedValue: Int, newValue: Int): Int

Atomically stores the new value into the element of this AtomicIntArray at the given index if the current value equals the expected value and returns the old value of the element in any case.

Since Kotlin 2.1
actual fun compareAndExchangeAt(index: Int, expectedValue: Int, newValue: Int): Int

Atomically stores the new value into the element of this AtomicIntArray at the given index if the current value equals the expected value and returns the old value of the element in any case.

Since Kotlin 2.1
actual fun compareAndExchangeAt(index: Int, expectedValue: Int, newValue: Int): Int

Atomically stores the new value into the element of this AtomicIntArray at the given index if the current value equals the expected value and returns the old value of the element in any case.

Since Kotlin 2.1
actual fun compareAndExchangeAt(index: Int, expectedValue: Int, newValue: Int): Int

Atomically stores the new value into the element of this AtomicIntArray at the given index if the current value equals the expected value and returns the old value of the element in any case.

Since Kotlin 2.1
actual fun compareAndExchangeAt(index: Int, expectedValue: Int, newValue: Int): Int

Atomically stores the new value into the element of this AtomicIntArray at the given index if the current value equals the expected value and returns the old value of the element in any case.

Since Kotlin 2.1
Link copied to clipboard
fun compareAndSet(index: Int, expectedValue: Int, newValue: Int): Boolean

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.

Since Kotlin 2.1
Link copied to clipboard
expect fun compareAndSetAt(index: Int, expectedValue: Int, newValue: Int): Boolean

Atomically stores the new value into the element of this AtomicIntArray at the given index 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.

Since Kotlin 2.1
actual fun compareAndSetAt(index: Int, expectedValue: Int, newValue: Int): Boolean

Atomically stores the new value into the element of this AtomicIntArray at the given index 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.

Since Kotlin 2.1
actual fun compareAndSetAt(index: Int, expectedValue: Int, newValue: Int): Boolean

Atomically stores the new value into the element of this AtomicIntArray at the given index 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.

Since Kotlin 2.1
actual fun compareAndSetAt(index: Int, expectedValue: Int, newValue: Int): Boolean

Atomically stores the new value into the element of this AtomicIntArray at the given index 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.

Since Kotlin 2.1
actual fun compareAndSetAt(index: Int, expectedValue: Int, newValue: Int): Boolean

Atomically stores the new value into the element of this AtomicIntArray at the given index 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.

Since Kotlin 2.1
actual fun compareAndSetAt(index: Int, expectedValue: Int, newValue: Int): Boolean

Atomically stores the new value into the element of this AtomicIntArray at the given index 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.

Since Kotlin 2.1
Link copied to clipboard

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

Since Kotlin 2.1
Link copied to clipboard
fun decrementAndGet(index: Int): Int

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

Since Kotlin 2.1
Link copied to clipboard
expect fun exchangeAt(index: Int, newValue: Int): Int

Atomically stores the new value into the element of this AtomicIntArray at the given index and returns the old value of the element.

Since Kotlin 2.1
actual fun exchangeAt(index: Int, newValue: Int): Int

Atomically stores the new value into the element of this AtomicIntArray at the given index and returns the old value of the element.

Since Kotlin 2.1
actual fun exchangeAt(index: Int, newValue: Int): Int

Atomically stores the new value into the element of this AtomicIntArray at the given index and returns the old value of the element.

Since Kotlin 2.1
actual fun exchangeAt(index: Int, newValue: Int): Int

Atomically stores the new value into the element of this AtomicIntArray at the given index and returns the old value of the element.

Since Kotlin 2.1
actual fun exchangeAt(index: Int, newValue: Int): Int

Atomically stores the new value into the element of this AtomicIntArray at the given index and returns the old value of the element.

Since Kotlin 2.1
actual fun exchangeAt(index: Int, newValue: Int): Int

Atomically stores the new value into the element of this AtomicIntArray at the given index and returns the old value of the element.

Since Kotlin 2.1
Link copied to clipboard
expect fun fetchAndAddAt(index: Int, delta: Int): Int

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

Since Kotlin 2.1
actual fun fetchAndAddAt(index: Int, delta: Int): Int

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

Since Kotlin 2.1
actual fun fetchAndAddAt(index: Int, delta: Int): Int

Atomically adds the given delta the element of this AtomicIntArray at the given index by and returns the old value of the element.

Since Kotlin 2.1
actual fun fetchAndAddAt(index: Int, delta: Int): Int

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

Since Kotlin 2.1
actual fun fetchAndAddAt(index: Int, delta: Int): Int

Atomically adds the given delta the element of this AtomicIntArray at the given index by and returns the old value of the element.

Since Kotlin 2.1
actual fun fetchAndAddAt(index: Int, delta: Int): Int

Atomically adds the given delta the element of this AtomicIntArray at the given index by and returns the old value of the element.

Since Kotlin 2.1
Link copied to clipboard

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

Since Kotlin 2.1
Link copied to clipboard

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

Since Kotlin 2.1
Link copied to clipboard
operator fun get(index: Int): Int

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

Since Kotlin 2.1
Link copied to clipboard
fun getAndAdd(index: Int, delta: Int): Int

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

Since Kotlin 2.1
Link copied to clipboard
fun getAndDecrement(index: Int): Int

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

Since Kotlin 2.1
Link copied to clipboard
fun getAndIncrement(index: Int): Int

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

Since Kotlin 2.1
Link copied to clipboard
fun getAndSet(index: Int, newValue: Int): Int

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

Since Kotlin 2.1
Link copied to clipboard

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

Since Kotlin 2.1
Link copied to clipboard
fun incrementAndGet(index: Int): Int

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

Since Kotlin 2.1
Link copied to clipboard
expect fun loadAt(index: Int): Int

Atomically loads the value from the element of this AtomicIntArray at the given index.

Since Kotlin 2.1
actual fun loadAt(index: Int): Int

Atomically loads the value from the element of this AtomicIntArray at the given index.

Since Kotlin 2.1
actual fun loadAt(index: Int): Int

Atomically loads the value from the element of this AtomicIntArray at the given index.

Since Kotlin 2.1
actual fun loadAt(index: Int): Int

Atomically loads the value from the element of this AtomicIntArray at the given index.

Since Kotlin 2.1
actual fun loadAt(index: Int): Int

Atomically loads the value from the element of this AtomicIntArray at the given index.

Since Kotlin 2.1
actual fun loadAt(index: Int): Int

Atomically loads the value from the element of this AtomicIntArray at the given index.

Since Kotlin 2.1
Link copied to clipboard
operator fun set(index: Int, newValue: Int)

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

Since Kotlin 2.1
Link copied to clipboard
expect fun storeAt(index: Int, newValue: Int)

Atomically stores the new value into the element of this AtomicIntArray at the given index.

Since Kotlin 2.1
actual fun storeAt(index: Int, newValue: Int)

Atomically stores the new value into the element of this AtomicIntArray at the given index.

Since Kotlin 2.1
actual fun storeAt(index: Int, newValue: Int)

Atomically stores the new value into the element of this AtomicIntArray at the given index.

Since Kotlin 2.1
actual fun storeAt(index: Int, newValue: Int)

Atomically stores the new value into the element of this AtomicIntArray at the given index.

Since Kotlin 2.1
actual fun storeAt(index: Int, newValue: Int)

Atomically stores the new value into the element of this AtomicIntArray at the given index.

Since Kotlin 2.1
actual fun storeAt(index: Int, newValue: Int)

Atomically stores the new value into the element of this AtomicIntArray at the given index.

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

Returns the string representation of the underlying array of ints.

Since Kotlin 2.1
actual open override fun toString(): String

Returns the string representation of the underlying array of ints.

Since Kotlin 2.1
actual open override fun toString(): String

Returns the string representation of the underlying array of ints.

Since Kotlin 2.1
actual open override fun toString(): String

Returns the string representation of the underlying array of ints.

Since Kotlin 2.1
actual open override fun toString(): String

Returns the string representation of the underlying array of ints.

Since Kotlin 2.1
actual open override fun toString(): String

Returns the string representation of the underlying array of ints.

Since Kotlin 2.1