• 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_loom))]
7 use cfg_if::cfg_if;
8 
9 #[cfg(not(crossbeam_loom))]
10 cfg_if! {
11     // Use "wide" sequence lock if the pointer width <= 32 for preventing its counter against wrap
12     // around.
13     //
14     // We are ignoring too wide architectures (pointer width >= 256), since such a system will not
15     // appear in a conceivable future.
16     //
17     // In narrow architectures (pointer width <= 16), the counter is still <= 32-bit and may be
18     // vulnerable to wrap around. But it's mostly okay, since in such a primitive hardware, the
19     // counter will not be increased that fast.
20     if #[cfg(any(target_pointer_width = "64", target_pointer_width = "128"))] {
21         mod seq_lock;
22     } else {
23         #[path = "seq_lock_wide.rs"]
24         mod seq_lock;
25     }
26 }
27 
28 mod atomic_cell;
29 mod consume;
30 
31 pub use self::atomic_cell::AtomicCell;
32 pub use self::consume::AtomicConsume;
33