load
Требования к платформе и версии: Common (2.1), JS (2.1), Native (2.1), Wasm-JS (2.1), Wasm-WASI (2.1)
expect fun load(): Int
Атомарно загружает значение из этого AtomicInt.
Примеры
import kotlin.concurrent.atomics.*
import kotlin.concurrent.thread
fun main() {
//sampleStart
val a = AtomicInt(7)
println(a.load()) // 7
//sampleEnd
}
Требования к платформе и версии: JVM (2.1)
actual fun load(): Int
Атомарно загружает значение из этого AtomicInt.
Имеет те же эффекты памяти, что и java.util.concurrent.atomic.AtomicInteger.get.
Примеры
import kotlin.concurrent.atomics.*
import kotlin.concurrent.thread
fun main() {
//sampleStart
val a = AtomicInt(7)
println(a.load()) // 7
//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-int/load.html