#channel #mpmc #spsc #spmc #mpsc

concurrent-queue

Concurrent multi-producer multi-consumer queue

8 releases (stable)

new 1.2.2 Aug 5, 2020
1.2.1 Aug 4, 2020
1.2.0 Jul 31, 2020
1.1.1 Jun 2, 2020
0.0.1 May 17, 2020

#73 in Concurrency

Download history 11/week @ 2020-05-12 4/week @ 2020-05-19 57/week @ 2020-05-26 175/week @ 2020-06-02 133/week @ 2020-06-09 9086/week @ 2020-06-16 17695/week @ 2020-06-23 20700/week @ 2020-06-30 23833/week @ 2020-07-07 27516/week @ 2020-07-14 32538/week @ 2020-07-21 32412/week @ 2020-07-28 33704/week @ 2020-08-04

58,424 downloads per month
Used in 564 crates (6 directly)

Apache-2.0 OR MIT

45KB
734 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

~9KB