AtomicLongArray
An LongArray in which elements are always updated atomically. For additional details about atomicity guarantees for reads and writes see kotlin.concurrent.Volatile .
Constructors
<init>
Creates a new AtomicLongArray of the given size , with all elements initialized to zero.
AtomicLongArray
(
size
:
Int
)
Properties
length
Returns the number of elements in the array.
val
length
:
Int
Functions
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
:
Long
,
newValue
:
Long
)
:
Long
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
:
Long
,
newValue
:
Long
)
:
Boolean
decrementAndGet
Atomically decrements the element at the given index by one and returns the new value of the element.
fun
decrementAndGet
(
index
:
Int
)
:
Long
get
Atomically gets the value of the element at the given index .
operator
fun
get
(
index
:
Int
)
:
Long
getAndDecrement
Atomically decrements the element at the given index by one and returns the old value of the element.
fun
getAndDecrement
(
index
:
Int
)
:
Long
getAndIncrement
Atomically increments the element at the given index by one and returns the old value of the element.
fun
getAndIncrement
(
index
:
Int
)
:
Long
incrementAndGet
Atomically increments the element at the given index by one and returns the new value of the element.
fun
incrementAndGet
(
index
:
Int
)
:
Long