AtomicLong

class AtomicLong(var value: Long = 0)(source)

Deprecated (with error)

Use kotlin.concurrent.AtomicLong instead.

Replace with

kotlin.concurrent.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.3

Constructors

Link copied to clipboard
constructor(value: Long = 0)

Properties

Link copied to clipboard
Since Kotlin 1.3

Functions

Link copied to clipboard
fun addAndGet(delta: Int): Long
fun addAndGet(delta: Long): Long

Atomically adds the given value to the current value and returns the new value.

Since Kotlin 1.3
Link copied to clipboard
fun compareAndSet(expected: Long, newValue: Long): Boolean

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.

Since Kotlin 1.3
Link copied to clipboard
fun compareAndSwap(expected: Long, newValue: Long): Long

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.

Since Kotlin 1.3
Link copied to clipboard
fun decrement()

Atomically decrements the current value by one.

Since Kotlin 1.3
Link copied to clipboard

Atomically decrements the current value by one and returns the new value.

Since Kotlin 1.3
Link copied to clipboard
fun getAndAdd(delta: Long): Long

Atomically adds the given value to the current value and returns the old value.

Since Kotlin 1.3
Link copied to clipboard

Atomically decrements the current value by one and returns the old value.

Since Kotlin 1.3
Link copied to clipboard

Atomically increments the current value by one and returns the old value.

Since Kotlin 1.3
Link copied to clipboard
fun getAndSet(newValue: Long): Long

Atomically sets the value to the given new value and returns the old value.

Since Kotlin 1.3
Link copied to clipboard
fun increment()

Atomically increments the current value by one.

Since Kotlin 1.3
Link copied to clipboard

Atomically increments the current value by one and returns the new value.

Since Kotlin 1.3
Link copied to clipboard
open override fun toString(): String

Returns the string representation of this object.

Since Kotlin 1.3