AtomicLongArray

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

Platform-specific implementation details:

When targeting the Native backend, AtomicLongArray stores a LongArray 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 AtomicLongArray are represented by java.util.concurrent.atomic.AtomicLongArray. 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 AtomicLongArray is implemented trivially and is not thread-safe since these platforms do not support multi-threading.

Since Kotlin

2.1

An array of longs 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 longs in which elements may be updated atomically.

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

Since Kotlin

2.1

An array of longs 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 longs 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 longs 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 AtomicLongArray of the specified size, with all elements initialized to zero.

expect constructor(array: LongArray)

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

actual constructor(size: Int)

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

actual constructor(array: LongArray)

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

actual constructor(size: Int)

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

actual constructor(array: LongArray)

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

actual constructor(size: Int)

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

actual constructor(array: LongArray)

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

actual constructor(size: Int)

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

actual constructor(array: LongArray)

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

actual constructor(size: Int)

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

actual constructor(array: LongArray)

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: Long): Long

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

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

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

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

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

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

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

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

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

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

Atomically adds the given delta the element of this AtomicLongArray 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: Long): Long

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: Long, newValue: Long): Long

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: Long, newValue: Long): Long

Atomically stores the new value into the element of this AtomicLongArray 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: Long, newValue: Long): Long

Atomically stores the new value into the element of this AtomicLongArray 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: Long, newValue: Long): Long

Atomically stores the new value into the element of this AtomicLongArray 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: Long, newValue: Long): Long

Atomically stores the new value into the element of this AtomicLongArray 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: Long, newValue: Long): Long

Atomically stores the new value into the element of this AtomicLongArray 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: Long, newValue: Long): Long

Atomically stores the new value into the element of this AtomicLongArray 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: Long, newValue: Long): 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: Long, newValue: Long): Boolean

Atomically stores the new value into the element of this AtomicLongArray 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: Long, newValue: Long): Boolean

Atomically stores the new value into the element of this AtomicLongArray 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: Long, newValue: Long): Boolean

Atomically stores the new value into the element of this AtomicLongArray 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: Long, newValue: Long): Boolean

Atomically stores the new value into the element of this AtomicLongArray 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: Long, newValue: Long): Boolean

Atomically stores the new value into the element of this AtomicLongArray 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: Long, newValue: Long): Boolean

Atomically stores the new value into the element of this AtomicLongArray 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 AtomicLongArray 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): Long

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: Long): Long

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

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

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

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

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

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

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

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

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

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

Atomically stores the new value into the element of this AtomicLongArray 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: Long): Long

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

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

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

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

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

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

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

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

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

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

Atomically adds the given delta the element of this AtomicLongArray 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 AtomicLongArray 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 AtomicLongArray 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): Long

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

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

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): Long

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): Long

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: Long): Long

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 AtomicLongArray 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): Long

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): Long

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

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

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

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

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

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

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

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

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

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

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

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

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: Long)

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

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

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

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

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

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

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

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

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

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

Atomically stores the new value into the element of this AtomicLongArray 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 longs.

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

Returns the string representation of the underlying array of longs.

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

Returns the string representation of the underlying array of longs.

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

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

Returns the string representation of the underlying array of longs.

Since Kotlin 2.1