integer_atomics/
lib.rs

1//! This crate allows you to compile code that needs the unstable integer atomics types
2//! (`Atomic{U,I}{8,16,32,64}`) with the stable compiler.
3//!
4//! If the `nightly` feature is enabled, it simply re-exports these types from `std::sync::atomic`.
5//!
6//! Otherwise, they are emulated with the existing stable `AtomicUsize` and compare-exchange loops.
7//! Because of that, the `Atomic{U,I}64` types are only available on 64-bit platforms.
8//! Also, this is obviously much slower than real atomics. This is only a stopgap solution until
9//! those are finally stabilized.
10//!
11//! This crate has no documentation as these types are documented within the standard library docs.
12
13#![cfg_attr(feature = "nightly", feature(integer_atomics))]
14
15#[cfg(feature = "nightly")]
16use std::sync::atomic;
17
18#[cfg(not(feature = "nightly"))]
19mod atomic;
20
21pub use atomic::{AtomicI8, AtomicU8, AtomicI16, AtomicU16, AtomicI32, AtomicU32};
22#[cfg(target_pointer_width = "64")]
23pub use atomic::{AtomicI64, AtomicU64};
24