This crate provides a set of tools for concurrent programming:
ArcCell<T>is a shared mutable
AtomicCell<T>is equivalent to
Cell<T>, except it is also thread-safe.
AtomicConsumeallows reading from primitive atomic types with "consume" ordering.
dequemodule contains work-stealing deques for building task schedulers.
SegQueue<T>are simple concurrent queues.
TreiberStack<T>is a lock-free stack.
channelmodule contains multi-producer multi-consumer channels for message passing.
RwLock<T>, but sharded for faster concurrent reads.
WaitGroupenables threads to synchronize the beginning or end of some computation.
epochmodule contains epoch-based garbage collection.
CachePadded<T>pads and aligns a value to the length of a cache line.
scope()can spawn threads that borrow local variables from the stack.
Some of the tools live in the main
crossbeam crate, and some are re-exported
from smaller subcrates:
crossbeam-channelprovides multi-producer multi-consumer channels for message passing.
crossbeam-dequeprovides work-stealing deques, which are primarily intended for building task schedulers.
crossbeam-epochprovides epoch-based garbage collection for building concurrent data structures.
crossbeam-utilsprovides miscellaneous utilities for concurrent programming:
Take a look at src/lib.rs to see what goes where.
There is one more experimental subcrate that is not yet included in
crossbeam-skiplistprovides concurrent maps and sets based on lock-free skip lists.
Add this to your
[dependencies] crossbeam = "0.6"
Next, add this to your crate:
extern crate crossbeam;
The minimum supported Rust version is 1.26.
Features available in
epoch(nightly Rust only)
Crossbeam welcomes contribution from everyone in the form of suggestions, bug reports, pull requests, and feedback. 💛
If you're looking for things to do, there are several easy ways to get started:
- Found a bug or have a feature request? Tell us!
- Issues and PRs labeled with feedback wanted need feedback from users and contributors.
- Issues labeled with good first issue are relatively easy starter issues.
We also have the RFCs repository for more high-level discussion. It is a place where we brainstorm ideas and propose substantial changes to Crossbeam.
If you'd like to learn more about concurrency and non-blocking data structures, there's a list of learning resources in our wiki, which includes related blog posts, papers, videos, and other similar projects.
Another good place to visit is merged RFCs. They contain elaborate descriptions and rationale for features we've introduced to Crossbeam, but note that some of the written information is now out of date.
The Crossbeam project adheres to the Rust Code of Conduct. This describes the minimum behavior expected from all contributors.
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.
Some Crossbeam subcrates have additional licensing notices. Take a look at other readme files in this repository for more information.
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.