BlockingSpscQueue
zio.blocks.streams.queues.BlockingSpscQueue
A blocking single-producer single-consumer queue.
Backed by SpscRingBuffer for the fast path; uses LockSupport.park and LockSupport.unpark for blocking when the buffer is full or empty.
Two separate waiter slots are maintained — consumerWaiter and producerWaiter — so that each side registers in its own slot without overwriting the other side's registration. A single shared slot would introduce a lost-wakeup race: the producer could overwrite the consumer's registration before the consumer parks, causing the consumer's park to return via stale permit and then clear the producer's registration, leaving the producer permanently blocked.
Null elements are not permitted.
Value parameters
- capacity
-
The logical capacity. Rounded up to the next power of two internally.
Attributes
- Source
- BlockingSpscQueue.scala
- Graph
-
- Supertypes
Members list
In this article