AtomicInt

Native
1.9
class AtomicInt
(source)

An Int 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>

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

AtomicInt(value: Int)

Properties

Native
1.3

value

var value: Int

Functions

Native
1.3

addAndGet

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

fun addAndGet(delta: Int): Int
Native
1.3

compareAndExchange

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 compareAndExchange(expected: Int, newValue: Int): Int
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: Int, newValue: Int): Boolean
Native
1.3

decrementAndGet

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

fun decrementAndGet(): Int
Native
1.3

getAndAdd

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

fun getAndAdd(delta: Int): Int
Native
1.3

getAndDecrement

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

fun getAndDecrement(): Int
Native
1.3

getAndIncrement

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

fun getAndIncrement(): Int
Native
1.3

getAndSet

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

fun getAndSet(newValue: Int): Int
Native
1.3

incrementAndGet

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

fun incrementAndGet(): Int
Native
1.3

toString

Returns the string representation of the current value.

fun toString(): String