crossbeam 0.6.0

Tools for concurrent programming


Build Status License Cargo Documentation Rust 1.26+

This crate provides a set of tools for concurrent programming:

  • Atomics

    • ArcCell<T> is a shared mutable Arc<T> pointer.
    • AtomicCell<T> is equivalent to Cell<T>, except it is also thread-safe.
    • AtomicConsume allows reading from primitive atomic types with "consume" ordering.
  • Data structures

    • deque module contains work-stealing deques for building task schedulers.
    • MsQueue<T> and SegQueue<T> are simple concurrent queues.
    • TreiberStack<T> is a lock-free stack.
  • Synchronization

    • channel module contains multi-producer multi-consumer channels for message passing.
    • ShardedLock<T> is like RwLock<T>, but sharded for faster concurrent reads.
    • WaitGroup enables threads to synchronize the beginning or end of some computation.
  • Memory management

    • epoch module contains epoch-based garbage collection.
  • Utilities

    • 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-channel provides multi-producer multi-consumer channels for message passing.
  • crossbeam-deque provides work-stealing deques, which are primarily intended for building task schedulers.
  • crossbeam-epoch provides epoch-based garbage collection for building concurrent data structures.
  • crossbeam-utils provides miscellaneous utilities for concurrent programming:

Take a look at src/ to see what goes where.

There is one more experimental subcrate that is not yet included in crossbeam:


Add this to your Cargo.toml:

crossbeam = "0.6"

Next, add this to your crate:

extern crate crossbeam;


The minimum supported Rust version is 1.26.

Features available in no_std environments:

  • AtomicCell<T>
  • AtomicConsume
  • CachePadded<T>
  • 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.

Feel free to participate in any open issues or pull requests!

Learning resources

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

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.