arrow-fx-coroutines / arrow.fx.coroutines.stream.concurrent / SignallingAtomic
class ~~SignallingAtomic~~<A> :
Atomic
<A>,
Signal
<A>
Deprecated: Stream is deprecated in favor of KotlinX Flow. Use Channel
Pure holder of a single atomic value of type A
that can be both read and updated.
Composes Signal and Atomic together to make an signalling atomic value.
access | Obtains a snapshot of the current value, and a setter for updating it.suspend fun access(): Pair <A, suspend (A) -> Boolean > |
continuous | Returns a stream of the current value of the signal. An element is always available – on each pull, the current value is supplied.fun continuous(): Stream <A> |
discrete | Returns a stream of the updates to this signal.fun discrete(): Stream <A> |
get | Obtains the current value. Since AtomicRef is always guaranteed to have a value, the returned action completes immediately after being bound.suspend fun get(): A |
getAndSet | Replaces the current value with a, returning the old value.suspend fun getAndSet(a: A): A |
getAndUpdate | Modifies the current value using the supplied update function and returns the old value.suspend fun getAndUpdate(f: (A) -> A): A |
modify | Modify allows to inspect the state A of the AtomicRef, update it and extract a different state B.suspend fun <B> modify(f: (A) -> Pair <A, B>): B |
modifyGet | ModifyGet allows to inspect state A, update it and extract a different state B. In contrast to modify, it returns a Pair of the updated state A and the extracted state B.suspend fun <B> modifyGet(f: (A) -> Pair <A, B>): Pair <A, B> |
set | Sets the current value to a. The returned action completes after the reference has been successfully set.suspend fun set(a: A): Unit |
setAndGet | Replaces the current value with a, returning the new value.suspend fun setAndGet(a: A): A |
tryModify | Attempts to inspect the state, uptade it, and extract a different state.suspend fun <B> tryModify(f: (A) -> Pair <A, B>): B? |
tryUpdate | Attempts to modify the current value once, in contrast to update which calls f until it succeeds.suspend fun tryUpdate(f: (A) -> A): Boolean |
update | Updates the current value using the supplied function f.suspend fun update(f: (A) -> A): Unit |
updateAndGet | Modifies the current value using the supplied update function and returns the new value.suspend fun updateAndGet(f: (A) -> A): A |
invoke | suspend operator fun <A> invoke(initial: A): SignallingAtomic <A> |
unsafe | fun <A> unsafe(initial: A): SignallingAtomic <A> |
interrupt | fun <O> Signal < Boolean >.interrupt(stream: Stream <O>): Stream <O> |
Do you like Arrow?
✖