1# concurrent-queue
2
3[![Build](https://github.com/stjepang/concurrent-queue/workflows/Build%20and%20test/badge.svg)](
4https://github.com/stjepang/concurrent-queue/actions)
5[![License](https://img.shields.io/badge/license-MIT%2FApache--2.0-blue.svg)](
6https://github.com/stjepang/concurrent-queue)
7[![Cargo](https://img.shields.io/crates/v/concurrent-queue.svg)](
8https://crates.io/crates/concurrent-queue)
9[![Documentation](https://docs.rs/concurrent-queue/badge.svg)](
10https://docs.rs/concurrent-queue)
11
12A concurrent multi-producer multi-consumer queue.
13
14There are two kinds of queues:
15
161. Bounded queue with limited capacity.
172. Unbounded queue with unlimited capacity.
18
19Queues also have the capability to get closed at any point. When closed, no more items can be
20pushed into the queue, although the remaining items can still be popped.
21
22These features make it easy to build channels similar to `std::sync::mpsc` on top of this
23crate.
24
25## Examples
26
27```rust
28use concurrent_queue::ConcurrentQueue;
29
30let q = ConcurrentQueue::unbounded();
31q.push(1).unwrap();
32q.push(2).unwrap();
33
34assert_eq!(q.pop(), Ok(1));
35assert_eq!(q.pop(), Ok(2));
36```
37
38## License
39
40Licensed under either of
41
42 * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
43 * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
44
45at your option.
46
47#### Contribution
48
49Unless you explicitly state otherwise, any contribution intentionally submitted
50for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
51dual licensed as above, without any additional terms or conditions.
52