1# Crossbeam Utils 2 3[![Build Status](https://github.com/crossbeam-rs/crossbeam/workflows/CI/badge.svg)]( 4https://github.com/crossbeam-rs/crossbeam/actions) 5[![License](https://img.shields.io/badge/license-MIT_OR_Apache--2.0-blue.svg)]( 6https://github.com/crossbeam-rs/crossbeam/tree/master/crossbeam-utils#license) 7[![Cargo](https://img.shields.io/crates/v/crossbeam-utils.svg)]( 8https://crates.io/crates/crossbeam-utils) 9[![Documentation](https://docs.rs/crossbeam-utils/badge.svg)]( 10https://docs.rs/crossbeam-utils) 11[![Rust 1.36+](https://img.shields.io/badge/rust-1.36+-lightgray.svg)]( 12https://www.rust-lang.org) 13[![chat](https://img.shields.io/discord/569610676205781012.svg?logo=discord)](https://discord.gg/BBYwKq) 14 15This crate provides miscellaneous tools for concurrent programming: 16 17#### Atomics 18 19* [`AtomicCell`], a thread-safe mutable memory location.<sup>(no_std)</sup> 20* [`AtomicConsume`], for reading from primitive atomic types with "consume" ordering.<sup>(no_std)</sup> 21 22#### Thread synchronization 23 24* [`Parker`], a thread parking primitive. 25* [`ShardedLock`], a sharded reader-writer lock with fast concurrent reads. 26* [`WaitGroup`], for synchronizing the beginning or end of some computation. 27 28#### Utilities 29 30* [`Backoff`], for exponential backoff in spin loops.<sup>(no_std)</sup> 31* [`CachePadded`], for padding and aligning a value to the length of a cache line.<sup>(no_std)</sup> 32* [`scope`], for spawning threads that borrow local variables from the stack. 33 34*Features marked with <sup>(no_std)</sup> can be used in `no_std` environments.*<br/> 35 36[`AtomicCell`]: https://docs.rs/crossbeam-utils/*/crossbeam_utils/atomic/struct.AtomicCell.html 37[`AtomicConsume`]: https://docs.rs/crossbeam-utils/*/crossbeam_utils/atomic/trait.AtomicConsume.html 38[`Parker`]: https://docs.rs/crossbeam-utils/*/crossbeam_utils/sync/struct.Parker.html 39[`ShardedLock`]: https://docs.rs/crossbeam-utils/*/crossbeam_utils/sync/struct.ShardedLock.html 40[`WaitGroup`]: https://docs.rs/crossbeam-utils/*/crossbeam_utils/sync/struct.WaitGroup.html 41[`Backoff`]: https://docs.rs/crossbeam-utils/*/crossbeam_utils/struct.Backoff.html 42[`CachePadded`]: https://docs.rs/crossbeam-utils/*/crossbeam_utils/struct.CachePadded.html 43[`scope`]: https://docs.rs/crossbeam-utils/*/crossbeam_utils/thread/fn.scope.html 44 45## Usage 46 47Add this to your `Cargo.toml`: 48 49```toml 50[dependencies] 51crossbeam-utils = "0.8" 52``` 53 54## Compatibility 55 56Crossbeam Utils supports stable Rust releases going back at least six months, 57and every time the minimum supported Rust version is increased, a new minor 58version is released. Currently, the minimum supported Rust version is 1.36. 59 60## License 61 62Licensed under either of 63 64 * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) 65 * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) 66 67at your option. 68 69#### Contribution 70 71Unless you explicitly state otherwise, any contribution intentionally submitted 72for inclusion in the work by you, as defined in the Apache-2.0 license, shall be 73dual licensed as above, without any additional terms or conditions. 74