AtomicLongArray

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

Since Kotlin

1.9

Constructors

Link copied to clipboard
constructor(size: Int)

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

Properties

Link copied to clipboard
val length: Int

Returns the number of elements in the array.

Since Kotlin 1.9

Functions

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 1.9
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 1.9
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 1.9
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 1.9
Link copied to clipboard
operator fun get(index: Int): Long

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

Since Kotlin 1.9
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 1.9
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 1.9
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 1.9
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 1.9
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 1.9
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 1.9
Link copied to clipboard
open override fun toString(): String

Returns the string representation of the underlying IntArray.

Since Kotlin 1.9