subms-mpsc-queue 0.5.0

submillisecond.com cookbook recipe - concurrency: subms-mpsc-queue. Vyukov-style multi-producer single-consumer linked queue with dangling-tail handling.
Documentation
  • Coverage
  • 88.89%
    8 out of 9 items documented1 out of 6 items with examples
  • Size
  • Source code size: 67.47 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 346.39 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 2s Average build duration of successful builds.
  • all releases: 3s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • kdog007

MPSC queue - Rust

Vyukov's multi-producer single-consumer linked queue. Producers swap the head; consumer walks next pointers. The dangling-tail window is the whole story.

Part of the submillisecond.com cookbook. Zero external dependencies; std only.

Install

[dependencies]
subms-mpsc-queue = "0.4"

Quickstart

cargo test --release
cargo run --example demo

Public API

  • pub enum PopResult<T>
  • pub struct MpscQueue<T>
  • pub fn new() -> Self
  • pub fn push(&self, value: T)
  • pub fn try_pop(&mut self) -> PopResult<T>

Files

  • src/lib.rs - implementation.
  • tests/ - integration tests; correctness, edge cases, property/stress.
  • examples/demo.rs - stdout walkthrough.
  • examples/perf_main.rs - bench entry (behind the harness feature).

License

Dual-licensed under MIT OR Apache-2.0.