• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //! Atomic types.
2 //!
3 //! * [`AtomicCell`], a thread-safe mutable memory location.
4 //! * [`AtomicConsume`], for reading from primitive atomic types with "consume" ordering.
5 
6 #[cfg(not(crossbeam_no_atomic_cas))]
7 #[cfg(not(crossbeam_loom))]
8 cfg_if::cfg_if! {
9     // Use "wide" sequence lock if the pointer width <= 32 for preventing its counter against wrap
10     // around.
11     //
12     // We are ignoring too wide architectures (pointer width >= 256), since such a system will not
13     // appear in a conceivable future.
14     //
15     // In narrow architectures (pointer width <= 16), the counter is still <= 32-bit and may be
16     // vulnerable to wrap around. But it's mostly okay, since in such a primitive hardware, the
17     // counter will not be increased that fast.
18     if #[cfg(any(target_pointer_width = "64", target_pointer_width = "128"))] {
19         mod seq_lock;
20     } else {
21         #[path = "seq_lock_wide.rs"]
22         mod seq_lock;
23     }
24 }
25 
26 #[cfg(not(crossbeam_no_atomic_cas))]
27 mod atomic_cell;
28 mod consume;
29 
30 #[cfg(not(crossbeam_no_atomic_cas))]
31 pub use self::atomic_cell::AtomicCell;
32 pub use self::consume::AtomicConsume;
33