Package arrow.fx.stm


Name Summary
STM common interface STM
Software transactional memory, or STM, is an abstraction for concurrent state modification. With STM one can write code that concurrently accesses state and that can easily be composed without exposing details of how it ensures safety guarantees. Programs running within an STM transaction will neither deadlock nor have race-conditions.
TArray common data class TArray<A>
A TArray is an array of transactional variables.
TMap common data class TMap<K, V>
A TMap is a concurrent transactional implementation of a key value hashmap.
TMVar common data class TMVar<A>
A TMVar is a mutable reference that can either be empty or hold a value.
TQueue common data class TQueue<A>
A TQueue is a transactional unbounded queue which can be written to and read from concurrently.
TSemaphore common data class TSemaphore
TSemaphore is the transactional Semaphore.
TSet common data class TSet<A>
A TSet is a concurrent transactional implementation of a hashset.
TVar common class TVar<A>
A TVar is a mutable reference that can only be (safely) accessed inside a STM transaction.


Name Summary
atomically common suspend fun <A> atomically(f: STM.() -> A): A
Run a transaction to completion.
check common fun STM.check(b: Boolean)
Retry if b is false otherwise does nothing.
newEmptyTMVar common fun <A> STM.newEmptyTMVar(): TMVar<A>
newTArray common fun <A> STM.newTArray(vararg arr: A): TArray<A>
fun <A> STM.newTArray(xs: Iterable<A>): TArray<A>
fun <A> STM.newTArray(size: Int, a: A): TArray<A>
fun <A> STM.newTArray(size: Int, f: (Int) -> A): TArray<A>
newTMap common fun <K, V> STM.newTMap(): TMap<K, V>
fun <K, V> STM.newTMap(fn: (K) -> Int): TMap<K, V>
newTMVar common fun <A> STM.newTMVar(a: A): TMVar<A>
newTQueue common fun <A> STM.newTQueue(): TQueue<A>
newTSem common fun STM.newTSem(initial: Int): TSemaphore
newTSet common fun <A> STM.newTSet(): TSet<A>
fun <A> STM.newTSet(fn: (A) -> Int): TSet<A>
stm common inline fun <A> stm(noinline f: STM.() -> A): STM.() -> A
Helper to create stm blocks that can be run with STM.orElse

Do you like Arrow?

Arrow Org