1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//! Synchronization primitives, and utilities for implementing them.

#[cfg(loom)]
pub use loom::sync::atomic;

#[cfg(not(loom))]
pub use core::sync::atomic;

pub mod cell;

pub use self::once::{InitOnce, Lazy};
pub use maitake_sync::{spin::once, util::CachePadded};

/// Spinlocks and related synchronization primitives.
pub mod spin {
    pub use maitake_sync::{
        spin::{Mutex, MutexGuard},
        util::Backoff,
    };
}
/// A wrapper for the [`core::hint`] module that emits either [`loom`] spin loop
/// hints (when `cfg(loom)` is enabled), or real spin loop hints when loom is
/// not enabled.
///
/// [`loom`]: https://crates.io/crates/loom
pub mod hint {
    #[cfg(not(loom))]
    pub use core::hint::spin_loop;

    #[cfg(loom)]
    pub use loom::sync::atomic::spin_loop_hint as spin_loop;
}