Skip to main content

Module batch

Module batch 

Source
Expand description

Batch dequeue: drain up to N items in one fenced pass.

Wraps the base MpscQueue with a BatchMpscQueue::try_dequeue_batch that pays one acquire-fence per call instead of one per item. The pass follows next pointers from the consumer-private tail; the single acquire on the head establishes the ordering boundary, and every subsequent in-batch link read is relaxed because the chain is already published.

Stops early when:

  • out is full,
  • the chain ends (truly empty), or
  • a producer is mid-publish (dangling-tail window).

Returns the number of items written to out.

Structsยง

BatchMpscQueue
Batch-draining wrapper around the base MpscQueue.