store At
Требования к платформе и версии: Common (2.1), JS (2.1), Native (2.1), Wasm-JS (2.1), Wasm-WASI (2.1)
expect fun storeAt(index: Int, newValue: Long)
Атомарно сохраняет новое значение в элементе этого AtomicLongArray по заданному индексу.
Исключения
если индекс выходит за пределы этого массива.
Примеры
import kotlin.concurrent.atomics.*
import kotlin.concurrent.atomics.AtomicArray
import kotlin.test.assertFailsWith
fun main() {
//sampleStart
val a = AtomicLongArray(3)
a.storeAt(1, 7)
println(a.loadAt(1)) // 7
println(a.toString()) // [0, 7, 0]
//sampleEnd
}
Требования к платформе и версии: JVM (2.1)
actual fun storeAt(index: Int, newValue: Long)
Атомарно сохраняет новое значение в элементе этого AtomicLongArray по заданному индексу.
Имеет те же эффекты памяти, что и java.util.concurrent.atomic.AtomicLongArray.set.
Исключения
если индекс выходит за пределы этого массива.
Примеры
import kotlin.concurrent.atomics.*
import kotlin.concurrent.atomics.AtomicArray
import kotlin.test.assertFailsWith
fun main() {
//sampleStart
val a = AtomicLongArray(3)
a.storeAt(1, 7)
println(a.loadAt(1)) // 7
println(a.toString()) // [0, 7, 0]
//sampleEnd
}
© 2010–2026 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.concurrent.atomics/-atomic-long-array/store-at.html