]> git.proxmox.com Git - rustc.git/blob - vendor/crossbeam-utils/src/lib.rs
New upstream version 1.40.0+dfsg1
[rustc.git] / vendor / crossbeam-utils / src / lib.rs
1 //! Miscellaneous tools for concurrent programming.
2 //!
3 //! ## Atomics
4 //!
5 //! * [`AtomicCell`], a thread-safe mutable memory location.
6 //! * [`AtomicConsume`], for reading from primitive atomic types with "consume" ordering.
7 //!
8 //! ## Thread synchronization
9 //!
10 //! * [`Parker`], a thread parking primitive.
11 //! * [`ShardedLock`], a sharded reader-writer lock with fast concurrent reads.
12 //! * [`WaitGroup`], for synchronizing the beginning or end of some computation.
13 //!
14 //! ## Utilities
15 //!
16 //! * [`Backoff`], for exponential backoff in spin loops.
17 //! * [`CachePadded`], for padding and aligning a value to the length of a cache line.
18 //! * [`scope`], for spawning threads that borrow local variables from the stack.
19 //!
20 //! [`AtomicCell`]: atomic/struct.AtomicCell.html
21 //! [`AtomicConsume`]: atomic/trait.AtomicConsume.html
22 //! [`Parker`]: sync/struct.Parker.html
23 //! [`ShardedLock`]: sync/struct.ShardedLock.html
24 //! [`WaitGroup`]: sync/struct.WaitGroup.html
25 //! [`Backoff`]: struct.Backoff.html
26 //! [`CachePadded`]: struct.CachePadded.html
27 //! [`scope`]: thread/fn.scope.html
28
29 #![warn(missing_docs)]
30 #![warn(missing_debug_implementations)]
31 #![cfg_attr(not(feature = "std"), no_std)]
32 #![cfg_attr(feature = "nightly", feature(alloc))]
33 #![cfg_attr(feature = "nightly", feature(cfg_target_has_atomic))]
34
35 #[macro_use]
36 extern crate cfg_if;
37 #[cfg(feature = "std")]
38 extern crate core;
39
40 cfg_if! {
41 if #[cfg(feature = "nightly")] {
42 extern crate alloc;
43 } else {
44 mod alloc {
45 extern crate std;
46 pub use self::std::*;
47 }
48 }
49 }
50
51 pub mod atomic;
52
53 mod cache_padded;
54 pub use cache_padded::CachePadded;
55
56 mod backoff;
57 pub use backoff::Backoff;
58
59 cfg_if! {
60 if #[cfg(feature = "std")] {
61 #[macro_use]
62 extern crate lazy_static;
63
64 pub mod sync;
65 pub mod thread;
66 }
67 }