AtomicLong

Native
1.3
class AtomicLong
(source)
Deprecated: Use kotlin.concurrent.AtomicLong instead.

A Long value that is always updated atomically. For additional details about atomicity guarantees for reads and writes see kotlin.concurrent.Volatile.

Constructors

Native
1.3

<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

Native
1.3

value

var value: Long

Functions

Native
1.3

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
Native
1.3

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
Native
1.3

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
Native
1.3

decrement

Atomically decrements the current value by one.

fun decrement()
Native
1.3

decrementAndGet

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

fun decrementAndGet(): Long
Native
1.3

getAndAdd

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

fun getAndAdd(delta: Long): Long
Native
1.3

getAndDecrement

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

fun getAndDecrement(): Long
Native
1.3

getAndIncrement

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

fun getAndIncrement(): Long
Native
1.3

getAndSet

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

fun getAndSet(newValue: Long): Long
Native
1.3

increment

Atomically increments the current value by one.

fun increment()
Native
1.3

incrementAndGet

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

fun incrementAndGet(): Long
Native
1.3

toString

Returns the string representation of this object.

fun toString(): String