LockFreeMPSCQueue

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.

In particular, the following execution is permitted for this queue, but is not permitted for a linearizable queue:

Thread 1: addLast(1) = true, removeFirstOrNull() = null
Thread 2: addLast(2) = 2 // this operation is concurrent with both operations in the first thread

Constructors

Link copied to clipboard
fun LockFreeMPSCQueue()

Functions

Link copied to clipboard
fun addLast(element: E): Boolean
Link copied to clipboard
fun close()
Link copied to clipboard
fun removeFirstOrNull(): E?

Properties

Link copied to clipboard
val isClosed: Boolean
Link copied to clipboard
val isEmpty: Boolean