High-performance non-blocking SPSC ring buffer specialized for Int.
Layout: a single Array[Long]. Each slot packs both the data and the occupancy/control signal into one 64-bit word:
- bits 32..63: tag (
0= empty,1= data,2= done) - bits 0..31: the user's
Intvalue (only meaningful when tag == 1)
This makes the slot's own value act as the FastFlow signal: every insert/remove is a single memory-ordered op on a single cache line. Zero is the empty marker because the array is zero-initialized; a stored value with a non-zero tag is always non-zero regardless of the Int payload (including 0, Int.MinValue, Int.MaxValue, etc.).
In-band "done" sentinel: producers can call offerDone() to insert an end-of-stream marker after the last data value. Consumers reading via pollPacked() receive EMPTY_PACKED for empty, DONE_PACKED for the sentinel, or a TAG_FULL | Int payload value for data. This removes the need for a separate control queue alongside the data queue.
SPSC: one producer thread, one consumer thread.
Value parameters
- capacity
-
must be a positive power of two
Attributes
- Companion
- object
- Source
- IntSpscRingBuffer.scala
- Graph
-
- Supertypes
Members list
Value members
Concrete methods
Attributes
- Source
- IntSpscRingBuffer.scala
Attributes
- Source
- IntSpscRingBuffer.scala
Attributes
- Source
- IntSpscRingBuffer.scala
Insert the in-band done sentinel. Returns false if the buffer is full; the caller is expected to retry until it succeeds.
Insert the in-band done sentinel. Returns false if the buffer is full; the caller is expected to retry until it succeeds.
Attributes
- Source
- IntSpscRingBuffer.scala
Attributes
- Source
- IntSpscRingBuffer.scala
Atomically polls the next slot and returns the raw packed value:
Atomically polls the next slot and returns the raw packed value:
EMPTY_PACKED(0L) — slot is empty; consumer index is NOT advanced.DONE_PACKED— in-band done sentinel; consumer index advanced.- any other value — packed data (
TAG_FULL | (a & LOW32_MASK)); consumer index advanced. The payload ispacked.toInt.
Attributes
- Source
- IntSpscRingBuffer.scala
Attributes
- Source
- IntSpscRingBuffer.scala
Attributes
- Source
- IntSpscRingBuffer.scala
Concrete fields
Attributes
- Source
- IntSpscRingBuffer.scala
Inherited fields
Attributes
- Inherited from:
- IntSpscConsumerFields (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad0 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad0 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad0 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad0 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad0 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad0 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad0 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad0 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad0 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad0 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad0 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad0 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad0 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad0 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad0 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad0 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad1 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad1 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad1 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad1 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad1 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad1 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad1 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad1 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad1 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad1 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad1 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad1 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad1 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad1 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad1 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad1 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad2 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad2 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad2 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad2 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad2 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad2 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad2 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad2 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad2 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad2 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad2 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad2 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad2 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad2 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad2 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscPad2 (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscProducerFields (hidden)
- Source
- IntSpscRingBuffer.scala
Attributes
- Inherited from:
- IntSpscProducerFields (hidden)
- Source
- IntSpscRingBuffer.scala