flush

open fun <A> TQueue<A>.flush(): List<A>(source)

Drains all entries of a TQueue into a single list.

import arrow.fx.stm.TQueue
import arrow.fx.stm.atomically

suspend fun main() {
//sampleStart
val tq = TQueue.new<Int>()
val result = atomically {
tq.write(2)
tq.write(4)

tq.flush()
}
//sampleEnd
println("Result $result")
println("Items in queue ${atomically { tq.flush() }}")
}

This function never retries.