diff options
Diffstat (limited to 'third_party/rust/crossbeam-utils-0.6.6/src/lib.rs')
-rw-r--r-- | third_party/rust/crossbeam-utils-0.6.6/src/lib.rs | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/third_party/rust/crossbeam-utils-0.6.6/src/lib.rs b/third_party/rust/crossbeam-utils-0.6.6/src/lib.rs new file mode 100644 index 0000000000..4df2ac8a45 --- /dev/null +++ b/third_party/rust/crossbeam-utils-0.6.6/src/lib.rs @@ -0,0 +1,67 @@ +//! Miscellaneous tools for concurrent programming. +//! +//! ## Atomics +//! +//! * [`AtomicCell`], a thread-safe mutable memory location. +//! * [`AtomicConsume`], for reading from primitive atomic types with "consume" ordering. +//! +//! ## Thread synchronization +//! +//! * [`Parker`], a thread parking primitive. +//! * [`ShardedLock`], a sharded reader-writer lock with fast concurrent reads. +//! * [`WaitGroup`], for synchronizing the beginning or end of some computation. +//! +//! ## Utilities +//! +//! * [`Backoff`], for exponential backoff in spin loops. +//! * [`CachePadded`], for padding and aligning a value to the length of a cache line. +//! * [`scope`], for spawning threads that borrow local variables from the stack. +//! +//! [`AtomicCell`]: atomic/struct.AtomicCell.html +//! [`AtomicConsume`]: atomic/trait.AtomicConsume.html +//! [`Parker`]: sync/struct.Parker.html +//! [`ShardedLock`]: sync/struct.ShardedLock.html +//! [`WaitGroup`]: sync/struct.WaitGroup.html +//! [`Backoff`]: struct.Backoff.html +//! [`CachePadded`]: struct.CachePadded.html +//! [`scope`]: thread/fn.scope.html + +#![warn(missing_docs)] +#![warn(missing_debug_implementations)] +#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(feature = "nightly", feature(cfg_target_has_atomic))] + +#[macro_use] +extern crate cfg_if; +#[cfg(feature = "std")] +extern crate core; + +cfg_if! { + if #[cfg(feature = "alloc")] { + extern crate alloc; + } else if #[cfg(feature = "std")] { + extern crate std as alloc; + } +} + +#[cfg_attr( + feature = "nightly", + cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr")) +)] +pub mod atomic; + +mod cache_padded; +pub use cache_padded::CachePadded; + +mod backoff; +pub use backoff::Backoff; + +cfg_if! { + if #[cfg(feature = "std")] { + #[macro_use] + extern crate lazy_static; + + pub mod sync; + pub mod thread; + } +} |