class

ForkJoin::WorkDeque

Inherits Reference < Object

Bounded single-producer, multi-consumer run queue.

The owning scheduler publishes into the ring and every scheduler may consume from its head. A packed pair of head indices lets one thief claim a batch before copying it into its own queue, while the owner continues to consume work beyond the claimed range.

Constants

CAPACITY = 256
HALF_CAPACITY = 128
MASK = 255_u32
OVERFLOW_BATCH = 129

Instance methods

drain
Source
empty?
Source
max_batch
Source
pop_local?

The owner consumes immediate local work before the FIFO ring.

Source
push_batch(fibers : Pointer(Fiber), count : Int32) : Nil

Publishes an owner-claimed injection batch. The caller limits the batch to the currently available first half of the ring.

Source
push_handoff(fiber : Fiber, injection : InjectionQueue) : Tuple(Bool, Bool)

Keep one continuation as the owner's next runnable fiber. Additional continuations enter the stealable ring so they can run in parallel.

Source
push_resumed(fiber : Fiber, injection : InjectionQueue) : Bool
Source
push_spawn(fiber : Fiber, injection : InjectionQueue) : Bool

Fresh local work uses a single LIFO slot. Displacing the previous entry into the FIFO ring preserves locality without allowing a local producer to monopolize the worker indefinitely.

Source
remaining_slots
Source
ring_empty?

Race-free emptiness check of the stealable ring only, safe to call from any thread. The owner's private slots (@lifo, @handoff) are not read because only the owner may observe them.

Source
size
Source
steal_into(thief : WorkDeque) : Tuple(Fiber, Int32) | Nil

Claims approximately half of this queue and transfers the batch into the thief's queue. One transferred fiber is returned immediately.

Source
stealable_work?
Source