plusAssign
Atomically adds the given value to the current value of this AtomicInt.
Since Kotlin
2.1Samples
import kotlin.concurrent.atomics.*
import kotlin.concurrent.thread
fun main() {
//sampleStart
val counter = AtomicInt(7)
counter += 10
println(counter.load()) // 17
//sampleEnd
}
Atomically adds the given value to the current value of this AtomicLong.
Since Kotlin
2.1Samples
import kotlin.concurrent.atomics.*
import kotlin.concurrent.thread
fun main() {
//sampleStart
val counter = AtomicLong(7)
counter += 10
println(counter.load()) // 17
//sampleEnd
}