AtomicLong

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

Wrapper around Long with atomic synchronized operations.

Legacy MM: Atomic values and freezing: this type is unique with regard to freezing. Namely, it provides mutating operations, while can participate in frozen subgraphs. So shared frozen objects can have mutable fields of AtomicLong type.

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

Increments the value by delta and returns the new value.

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

Compares value with expected and replaces it with new value if values matches.

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

Compares value with expected and replaces it with new value if values matches.

Since Kotlin 1.3
Link copied to clipboard
fun decrement()

Decrements value by one.

Since Kotlin 1.3
Link copied to clipboard
fun increment()

Increments value by one.

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

Returns the string representation of this object.

Since Kotlin 1.3