| 1 | # Crossbeam Utils |
| 2 | |
| 3 | []( |
| 4 | https://github.com/crossbeam-rs/crossbeam/actions) |
| 5 | []( |
| 6 | https://github.com/crossbeam-rs/crossbeam/tree/master/crossbeam-utils#license) |
| 7 | []( |
| 8 | https://crates.io/crates/crossbeam-utils) |
| 9 | []( |
| 10 | https://docs.rs/crossbeam-utils) |
| 11 | []( |
| 12 | https://www.rust-lang.org) |
| 13 | [](https://discord.com/invite/JXYwgWZ) |
| 14 | |
| 15 | This 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 | |
| 47 | Add this to your `Cargo.toml`: |
| 48 | |
| 49 | ```toml |
| 50 | [dependencies] |
| 51 | crossbeam-utils = "0.8" |
| 52 | ``` |
| 53 | |
| 54 | ## Compatibility |
| 55 | |
| 56 | Crossbeam Utils supports stable Rust releases going back at least six months, |
| 57 | and every time the minimum supported Rust version is increased, a new minor |
| 58 | version is released. Currently, the minimum supported Rust version is 1.60. |
| 59 | |
| 60 | ## License |
| 61 | |
| 62 | Licensed 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 | |
| 67 | at your option. |
| 68 | |
| 69 | #### Contribution |
| 70 | |
| 71 | Unless you explicitly state otherwise, any contribution intentionally submitted |
| 72 | for inclusion in the work by you, as defined in the Apache-2.0 license, shall be |
| 73 | dual licensed as above, without any additional terms or conditions. |