AtomicLong
A Long value that is always updated atomically. For additional details about atomicity guarantees for reads and writes see kotlin.concurrent.Volatile.
Since Kotlin
1.9Functions
Atomically adds the given value to the current value and returns the new value.
Atomically sets the value to the given new value if the current value equals the expected value and returns the old value in any case.
Atomically sets the value to the given new value if the current value equals the expected value, returns true if the operation was successful and false only if the current value was not equal to the expected value.
Atomically decrements the current value by one and returns the new value.
Atomically adds the given value to the current value and returns the old value.
Atomically decrements the current value by one and returns the old value.
Atomically increments the current value by one and returns the old value.
Atomically increments the current value by one and returns the new value.