minusAssign

Atomically subtracts the given value from the current value of this AtomicInt.

Since Kotlin

2.1

Samples

import kotlin.concurrent.atomics.*
import kotlin.concurrent.thread

fun main() { 
   //sampleStart 
   val counter = AtomicInt(7)
counter -= 10
println(counter.load()) // -3 
   //sampleEnd
}

Atomically subtracts the given value from the current value of this AtomicLong.

Since Kotlin

2.1

Samples

import kotlin.concurrent.atomics.*
import kotlin.concurrent.thread

fun main() { 
   //sampleStart 
   val counter = AtomicLong(7)
counter -= 10
println(counter.load()) // -3 
   //sampleEnd
}