nee-core / dev.neeffect.nee.atomic / AtomicRef

AtomicRef

class AtomicRef<A>

Constructors

<init>

AtomicRef(value: A)

Functions

compareAndSet

fun compareAndSet(expected: A, newValue: A): IO<Boolean>

get

fun get(): IO<A>

getAndSet

fun getAndSet(a: A): IO<A>

getAndUpdate

fun getAndUpdate(f: (A) -> A): IO<A>

modify

fun <B> modify(f: (A) -> Pair<A, B>): IO<B>

modifyGet

fun <B> modifyGet(f: (A) -> Pair<A, B>): IO<Pair<A, B>>

set

fun set(a: A): IO<Unit>

tryUpdate

fun tryUpdate(f: (A) -> A): IO<Boolean>

update

fun update(f: (A) -> A): IO<Unit>

updateAction

fun updateAction(f: (A) -> IO<A>): IO<A>

updateAndGet

fun updateAndGet(f: (A) -> A): IO<A>