14 stable releases
2.5.0 | Apr 26, 2024 |
---|---|
2.4.0 | Dec 2, 2023 |
2.3.0 | Sep 25, 2023 |
2.2.0 | Apr 7, 2023 |
0.0.1 | May 17, 2020 |
#50 in Concurrency
4,237,163 downloads per month
Used in 8,440 crates
(52 directly)
64KB
1K
SLoC
concurrent-queue
A concurrent multi-producer multi-consumer queue.
There are two kinds of queues:
- Bounded queue with limited capacity.
- 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
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
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–24MB
~338K SLoC