Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bevyengine
GitHub Repository: bevyengine/bevy
Path: blob/main/crates/bevy_platform/src/sync/atomic.rs
6849 views
1
//! Provides various atomic alternatives to language primitives.
2
//!
3
//! Certain platforms lack complete atomic support, requiring the use of a fallback
4
//! such as `portable-atomic`.
5
//! Using these types will ensure the correct atomic provider is used without the need for
6
//! feature gates in your own code.
7
8
pub use atomic_16::{AtomicI16, AtomicU16};
9
pub use atomic_32::{AtomicI32, AtomicU32};
10
pub use atomic_64::{AtomicI64, AtomicU64};
11
pub use atomic_8::{AtomicBool, AtomicI8, AtomicU8};
12
pub use atomic_ptr::{AtomicIsize, AtomicPtr, AtomicUsize};
13
pub use core::sync::atomic::Ordering;
14
15
#[cfg(target_has_atomic = "8")]
16
use core::sync::atomic as atomic_8;
17
18
#[cfg(not(target_has_atomic = "8"))]
19
use portable_atomic as atomic_8;
20
21
#[cfg(target_has_atomic = "16")]
22
use core::sync::atomic as atomic_16;
23
24
#[cfg(not(target_has_atomic = "16"))]
25
use portable_atomic as atomic_16;
26
27
#[cfg(target_has_atomic = "32")]
28
use core::sync::atomic as atomic_32;
29
30
#[cfg(not(target_has_atomic = "32"))]
31
use portable_atomic as atomic_32;
32
33
#[cfg(target_has_atomic = "64")]
34
use core::sync::atomic as atomic_64;
35
36
#[cfg(not(target_has_atomic = "64"))]
37
use portable_atomic as atomic_64;
38
39
#[cfg(target_has_atomic = "ptr")]
40
use core::sync::atomic as atomic_ptr;
41
42
#[cfg(not(target_has_atomic = "ptr"))]
43
use portable_atomic as atomic_ptr;
44
45