Expand description

[atomic_queue] is a port of C++’s max0x7ba/atomic_queue implementation to rust.

This is part of augmented-audio.

It provides a bounded multi-producer, multi-consumer lock-free queue that is real-time safe.

Usage

let queue: atomic_queue::Queue<usize> = atomic_queue::bounded(10);

queue.push(10);
if let Some(v) = queue.pop() {
    assert_eq!(v, 10);
}

Safety

This queue implementation uses unsafe internally.

Performance

When benchmarked on a 2017 i7, this was a lot slower than ringbuf (~2x).

I’d think this is fine since this queue supporting multiple consumers and multiple producers while ringbuf is single producer single consumer.

Testing again on a M1 Pro, it is 30% faster.

Structs

Atomic queue cloned from https://github.com/max0x7ba/atomic_queue

Functions

Alias for Queue::new, creates a new bounded MPMC queue with the given capacity.