AtomicLong
A Long value that is always updated atomically. For additional details about atomicity guarantees for reads and writes see kotlin.concurrent.Volatile.
Constructors
<init>
A Long value that is always updated atomically. For additional details about atomicity guarantees for reads and writes see kotlin.concurrent.Volatile.
AtomicLong(value: Long = 0L)
Properties
value
var value: Long
Functions
addAndGet
Atomically adds the given value to the current value and returns the new value.
fun addAndGet(delta: Long): Long
fun addAndGet(delta: Int): Long
compareAndSet
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.
fun compareAndSet(expected: Long, newValue: Long): Boolean
compareAndSwap
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.
fun compareAndSwap(expected: Long, newValue: Long): Long
decrement
Atomically decrements the current value by one.
fun decrement()
decrementAndGet
Atomically decrements the current value by one and returns the new value.
fun decrementAndGet(): Long
getAndAdd
Atomically adds the given value to the current value and returns the old value.
fun getAndAdd(delta: Long): Long
getAndDecrement
Atomically decrements the current value by one and returns the old value.
fun getAndDecrement(): Long
getAndIncrement
Atomically increments the current value by one and returns the old value.
fun getAndIncrement(): Long
getAndSet
Atomically sets the value to the given new value and returns the old value.
fun getAndSet(newValue: Long): Long
increment
Atomically increments the current value by one.
fun increment()
incrementAndGet
Atomically increments the current value by one and returns the new value.
fun incrementAndGet(): Long
toString
Returns the string representation of this object.
fun toString(): String