#channel #mpmc #mpsc #spsc #spmc #mpmc-queue

no-std concurrent-queue

Concurrent multi-producer multi-consumer queue

13 stable releases

2.4.0 Dec 2, 2023
2.3.0 Sep 25, 2023
2.2.0 Apr 7, 2023
2.1.0 Jan 15, 2023
0.0.1 May 17, 2020

#41 in Concurrency

Download history 362853/week @ 2023-12-23 453866/week @ 2023-12-30 533677/week @ 2024-01-06 564988/week @ 2024-01-13 622411/week @ 2024-01-20 736014/week @ 2024-01-27 603589/week @ 2024-02-03 574993/week @ 2024-02-10 591194/week @ 2024-02-17 618363/week @ 2024-02-24 633310/week @ 2024-03-02 633005/week @ 2024-03-09 638584/week @ 2024-03-16 644020/week @ 2024-03-23 686382/week @ 2024-03-30 578568/week @ 2024-04-06

2,652,822 downloads per month
Used in 6,655 crates (43 directly)

Apache-2.0 OR MIT

56KB
949 lines

concurrent-queue

Build License Cargo Documentation

A concurrent multi-producer multi-consumer queue.

There are two kinds of queues:

  1. Bounded queue with limited capacity.
  2. Unbounded queue with unlimited capacity.

Queues also have the capability to get closed at any point. When closed, no more items can be pushed into the queue, although the remaining items can still be popped.

These features make it easy to build channels similar to std::sync::mpsc on top of this crate.

Examples

use concurrent_queue::ConcurrentQueue;

let q = ConcurrentQueue::unbounded();
q.push(1).unwrap();
q.push(2).unwrap();

assert_eq!(q.pop(), Ok(1));
assert_eq!(q.pop(), Ok(2));

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~0–27MB
~356K SLoC