Package io.ktor.util.collections

Types

Link copied to clipboard
open class ConcurrentCollection<E>(delegate: MutableCollection<E>, lock: Lock) : MutableCollection<E>
Link copied to clipboard
class ConcurrentList<T> : MutableList<T>
Link copied to clipboard
class ConcurrentMap<Key : Any, Value : Any>(lock: Lock, initialCapacity: Int) : MutableMap<Key, Value>

Ktor concurrent map implementation. Please do not use it.

Link copied to clipboard
class ConcurrentSet<Key : Any>(lock: Lock, delegate: ConcurrentMap<Key, Unit>) : MutableSet<Key>

Concurrent set implemented on top of ConcurrentMap

Link copied to clipboard
class LockFreeMPSCQueue<E : Any>

Lock-free Multiply-Producer Single-Consumer Queue. Note: This queue is NOT linearizable. It provides only quiescent consistency for its operations.

Functions

Link copied to clipboard
inline fun <ERROR CLASS>.loop(action: (Long) -> Unit): Nothing

Infinite loop that reads this atomic variable and performs the specified action on its value.

inline fun <T> <ERROR CLASS><T>.loop(action: (T) -> Unit): Nothing
Link copied to clipboard
inline fun <ERROR CLASS>.update(function: (Long) -> Long)

Updates variable atomically using the specified function of its value.

Link copied to clipboard
inline fun <ERROR CLASS>.updateAndGet(function: (Long) -> Long): Long

Updates variable atomically using the specified function of its value and returns its new value.