concurrent-queue

Crates.ioconcurrent-queue
lib.rsconcurrent-queue
version2.5.0
sourcesrc
created_at2020-05-17 16:08:47.117572
updated_at2024-04-26 14:26:18.816602
descriptionConcurrent multi-producer multi-consumer queue
homepage
repositoryhttps://github.com/smol-rs/concurrent-queue
max_upload_size
id242702
size107,576
admins (github:smol-rs:admins)

documentation

README

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.

Commit count: 90

cargo fmt