From c3c1dea5312a31b2229c870ab71b4f057584eb70 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Thu, 15 Dec 2022 00:42:32 +0100 Subject: [PATCH] WIP: add feature to use critical-section. --- Cargo.toml | 3 ++ src/imp/interrupt/mod.rs | 16 ++++++ src/imp/mod.rs | 14 ++++- src/lib.rs | 110 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 141 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 97aed6287..efbc1ad09 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -61,6 +61,9 @@ std = [] # - The MSRV when this feature enables depends on the MSRV of serde. serde = { version = "1.0.103", optional = true, default-features = false } +# Use `critical-section`. +critical-section = { version = "1", optional = true } + [dev-dependencies] crossbeam-utils = "0.8" fastrand = "1" diff --git a/src/imp/interrupt/mod.rs b/src/imp/interrupt/mod.rs index 82c5a30be..3d7a5d3fe 100644 --- a/src/imp/interrupt/mod.rs +++ b/src/imp/interrupt/mod.rs @@ -31,8 +31,14 @@ // called while interrupts are disabled, and since the load/store is // atomic, it is not affected by interrupts even if interrupts are enabled. #[cfg(not(target_arch = "avr"))] +#[cfg(not(feature = "critical-section"))] use arch::atomic; +#[cfg(not(target_arch = "avr"))] +#[cfg(feature = "critical-section")] +use core::sync::atomic; + +#[cfg(not(feature = "critical-section"))] #[cfg_attr( all( target_arch = "arm", @@ -59,6 +65,16 @@ use core::{cell::UnsafeCell, sync::atomic::Ordering}; // provided in a similar way by the Linux kernel to be lock-free.) const IS_ALWAYS_LOCK_FREE: bool = true; +#[cfg(feature = "critical-section")] +#[inline] +fn with(f: F) -> R +where + F: FnOnce() -> R, +{ + critical_section::with(|_| f()) +} + +#[cfg(not(feature = "critical-section"))] #[inline] fn with(f: F) -> R where diff --git a/src/imp/mod.rs b/src/imp/mod.rs index b5a296ba2..9b292603d 100644 --- a/src/imp/mod.rs +++ b/src/imp/mod.rs @@ -5,6 +5,7 @@ #[cfg(not(any( portable_atomic_no_atomic_load_store, portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430", )))] @@ -115,6 +116,7 @@ mod fallback; #[cfg(any( all(test, target_os = "none"), portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430", ))] @@ -124,6 +126,7 @@ mod fallback; cfg(any(test, not(target_has_atomic = "ptr"))) )] #[cfg(any( + feature = "critical-section", target_arch = "arm", target_arch = "avr", target_arch = "msp430", @@ -144,6 +147,7 @@ pub(crate) mod float; #[cfg(not(any( portable_atomic_no_atomic_load_store, portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430", )))] @@ -168,6 +172,7 @@ pub(crate) use self::riscv::{ // no core Atomic{Isize,Usize,Bool,Ptr}/Atomic{I,U}{8,16} & assume single core => critical section based fallback #[cfg(any( portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" ))] @@ -181,6 +186,7 @@ pub(crate) use self::interrupt::{ #[cfg(not(any( portable_atomic_no_atomic_load_store, portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430", )))] @@ -193,7 +199,7 @@ pub(crate) use self::interrupt::{ )] pub(crate) use self::core_atomic::{AtomicI32, AtomicU32}; // RISC-V without A-extension -#[cfg(not(portable_atomic_unsafe_assume_single_core))] +#[cfg(not(any(portable_atomic_unsafe_assume_single_core, feature = "critical-section")))] #[cfg_attr(portable_atomic_no_cfg_target_has_atomic, cfg(portable_atomic_no_atomic_cas))] #[cfg_attr(not(portable_atomic_no_cfg_target_has_atomic), cfg(not(target_has_atomic = "ptr")))] #[cfg(any(target_arch = "riscv32", target_arch = "riscv64"))] @@ -202,6 +208,7 @@ pub(crate) use self::riscv::{AtomicI32, AtomicU32}; #[cfg(any(not(target_pointer_width = "16"), feature = "fallback"))] #[cfg(any( portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" ))] @@ -213,6 +220,7 @@ pub(crate) use self::interrupt::{AtomicI32, AtomicU32}; #[cfg(not(any( portable_atomic_no_atomic_load_store, portable_atomic_unsafe_assume_single_core, + feature = "critical-section", )))] #[cfg_attr(portable_atomic_no_cfg_target_has_atomic, cfg(not(portable_atomic_no_atomic_64)))] #[cfg_attr( @@ -230,7 +238,7 @@ pub(crate) use self::interrupt::{AtomicI32, AtomicU32}; )] pub(crate) use self::core_atomic::{AtomicI64, AtomicU64}; // RISC-V without A-extension -#[cfg(not(portable_atomic_unsafe_assume_single_core))] +#[cfg(not(any(portable_atomic_unsafe_assume_single_core, feature = "critical-section")))] #[cfg_attr(portable_atomic_no_cfg_target_has_atomic, cfg(portable_atomic_no_atomic_cas))] #[cfg_attr(not(portable_atomic_no_cfg_target_has_atomic), cfg(not(target_has_atomic = "ptr")))] #[cfg(target_arch = "riscv64")] @@ -253,6 +261,7 @@ pub(crate) use self::fallback::{AtomicI64, AtomicU64}; ))] #[cfg(any( portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" ))] @@ -320,6 +329,7 @@ pub(crate) use self::fallback::{AtomicI128, AtomicU128}; #[cfg(feature = "fallback")] #[cfg(any( portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" ))] diff --git a/src/lib.rs b/src/lib.rs index bad86292d..f09a7af7f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -615,6 +615,7 @@ impl AtomicBool { cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430", )) @@ -624,6 +625,7 @@ impl AtomicBool { cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -674,6 +676,7 @@ impl AtomicBool { cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -683,6 +686,7 @@ impl AtomicBool { cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -740,6 +744,7 @@ impl AtomicBool { cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -749,6 +754,7 @@ impl AtomicBool { cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -800,6 +806,7 @@ impl AtomicBool { cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -809,6 +816,7 @@ impl AtomicBool { cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -861,6 +869,7 @@ impl AtomicBool { cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -870,6 +879,7 @@ impl AtomicBool { cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -914,6 +924,7 @@ impl AtomicBool { cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -923,6 +934,7 @@ impl AtomicBool { cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -966,6 +978,7 @@ impl AtomicBool { cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -975,6 +988,7 @@ impl AtomicBool { cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -1027,6 +1041,7 @@ impl AtomicBool { cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -1036,6 +1051,7 @@ impl AtomicBool { cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -1079,6 +1095,7 @@ impl AtomicBool { cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -1088,6 +1105,7 @@ impl AtomicBool { cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -1140,6 +1158,7 @@ impl AtomicBool { cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -1149,6 +1168,7 @@ impl AtomicBool { cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -1188,6 +1208,7 @@ impl AtomicBool { cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -1197,6 +1218,7 @@ impl AtomicBool { cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -1245,6 +1267,7 @@ impl AtomicBool { cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -1254,6 +1277,7 @@ impl AtomicBool { cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -1315,6 +1339,7 @@ impl AtomicBool { cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -1324,6 +1349,7 @@ impl AtomicBool { cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -1587,6 +1613,7 @@ impl AtomicPtr { cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -1596,6 +1623,7 @@ impl AtomicPtr { cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -1639,6 +1667,7 @@ impl AtomicPtr { cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -1648,6 +1677,7 @@ impl AtomicPtr { cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -1705,6 +1735,7 @@ impl AtomicPtr { cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -1714,6 +1745,7 @@ impl AtomicPtr { cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -1789,6 +1821,7 @@ impl AtomicPtr { cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -1798,6 +1831,7 @@ impl AtomicPtr { cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -1860,6 +1894,7 @@ impl AtomicPtr { cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -1869,6 +1904,7 @@ impl AtomicPtr { cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -1913,6 +1949,7 @@ impl AtomicPtr { cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -1922,6 +1959,7 @@ impl AtomicPtr { cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -1962,6 +2000,7 @@ impl AtomicPtr { cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -1971,6 +2010,7 @@ impl AtomicPtr { cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -2023,6 +2063,7 @@ impl AtomicPtr { cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -2032,6 +2073,7 @@ impl AtomicPtr { cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -2099,6 +2141,7 @@ impl AtomicPtr { cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -2108,6 +2151,7 @@ impl AtomicPtr { cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -2173,6 +2217,7 @@ impl AtomicPtr { cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -2182,6 +2227,7 @@ impl AtomicPtr { cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -2246,6 +2292,7 @@ impl AtomicPtr { cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -2255,6 +2302,7 @@ impl AtomicPtr { cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -2283,6 +2331,7 @@ impl AtomicPtr { cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -2292,6 +2341,7 @@ impl AtomicPtr { cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -2571,6 +2621,7 @@ assert_eq!(some_var.swap(10, Ordering::Relaxed), 5); cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -2580,6 +2631,7 @@ assert_eq!(some_var.swap(10, Ordering::Relaxed), 5); cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -2634,6 +2686,7 @@ assert_eq!(some_var.load(Ordering::Relaxed), 10); cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -2643,6 +2696,7 @@ assert_eq!(some_var.load(Ordering::Relaxed), 10); cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -2706,6 +2760,7 @@ loop { cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -2715,6 +2770,7 @@ loop { cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -2760,6 +2816,7 @@ assert_eq!(foo.load(Ordering::SeqCst), 10); cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -2769,6 +2826,7 @@ assert_eq!(foo.load(Ordering::SeqCst), 10); cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -2809,6 +2867,7 @@ assert_eq!(foo.load(Ordering::SeqCst), 10); cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -2818,6 +2877,7 @@ assert_eq!(foo.load(Ordering::SeqCst), 10); cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -2852,6 +2912,7 @@ assert_eq!(foo.load(Ordering::SeqCst), 10); cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -2861,6 +2922,7 @@ assert_eq!(foo.load(Ordering::SeqCst), 10); cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -2901,6 +2963,7 @@ assert_eq!(foo.load(Ordering::SeqCst), 10); cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -2910,6 +2973,7 @@ assert_eq!(foo.load(Ordering::SeqCst), 10); cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -2947,6 +3011,7 @@ assert_eq!(foo.load(Ordering::SeqCst), 0b100001); cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -2956,6 +3021,7 @@ assert_eq!(foo.load(Ordering::SeqCst), 0b100001); cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3002,6 +3068,7 @@ assert_eq!(foo.load(Ordering::SeqCst), 0b100001); cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3011,6 +3078,7 @@ assert_eq!(foo.load(Ordering::SeqCst), 0b100001); cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3048,6 +3116,7 @@ assert_eq!(foo.load(Ordering::SeqCst), !(0x13 & 0x31)); cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3057,6 +3126,7 @@ assert_eq!(foo.load(Ordering::SeqCst), !(0x13 & 0x31)); cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3094,6 +3164,7 @@ assert_eq!(foo.load(Ordering::SeqCst), 0b111111); cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3103,6 +3174,7 @@ assert_eq!(foo.load(Ordering::SeqCst), 0b111111); cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3149,6 +3221,7 @@ assert_eq!(foo.load(Ordering::SeqCst), 0b111111); cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3158,6 +3231,7 @@ assert_eq!(foo.load(Ordering::SeqCst), 0b111111); cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3195,6 +3269,7 @@ assert_eq!(foo.load(Ordering::SeqCst), 0b011110); cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3204,6 +3279,7 @@ assert_eq!(foo.load(Ordering::SeqCst), 0b011110); cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3250,6 +3326,7 @@ assert_eq!(foo.load(Ordering::SeqCst), 0b011110); cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3259,6 +3336,7 @@ assert_eq!(foo.load(Ordering::SeqCst), 0b011110); cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3316,6 +3394,7 @@ assert_eq!(x.load(Ordering::SeqCst), 9); cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3325,6 +3404,7 @@ assert_eq!(x.load(Ordering::SeqCst), 9); cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3392,6 +3472,7 @@ assert!(max_foo == 42); cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3401,6 +3482,7 @@ assert!(max_foo == 42); cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3451,6 +3533,7 @@ assert_eq!(min_foo, 12); cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3460,6 +3543,7 @@ assert_eq!(min_foo, 12); cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3624,6 +3708,7 @@ This type has the same in-memory representation as the underlying floating point cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3633,6 +3718,7 @@ This type has the same in-memory representation as the underlying floating point cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3665,6 +3751,7 @@ This type has the same in-memory representation as the underlying floating point cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3674,6 +3761,7 @@ This type has the same in-memory representation as the underlying floating point cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3715,6 +3803,7 @@ This type has the same in-memory representation as the underlying floating point cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3724,6 +3813,7 @@ This type has the same in-memory representation as the underlying floating point cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3754,6 +3844,7 @@ This type has the same in-memory representation as the underlying floating point cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3763,6 +3854,7 @@ This type has the same in-memory representation as the underlying floating point cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3785,6 +3877,7 @@ This type has the same in-memory representation as the underlying floating point cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3794,6 +3887,7 @@ This type has the same in-memory representation as the underlying floating point cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3837,6 +3931,7 @@ This type has the same in-memory representation as the underlying floating point cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3846,6 +3941,7 @@ This type has the same in-memory representation as the underlying floating point cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3887,6 +3983,7 @@ This type has the same in-memory representation as the underlying floating point cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3896,6 +3993,7 @@ This type has the same in-memory representation as the underlying floating point cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3921,6 +4019,7 @@ This type has the same in-memory representation as the underlying floating point cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3930,6 +4029,7 @@ This type has the same in-memory representation as the underlying floating point cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3953,6 +4053,7 @@ This type has the same in-memory representation as the underlying floating point cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -3962,6 +4063,7 @@ This type has the same in-memory representation as the underlying floating point cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature="critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -4024,6 +4126,7 @@ atomic_int!(AtomicU32, u32, 4); any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" ) @@ -4040,6 +4143,7 @@ atomic_int!(AtomicU32, u32, 4); any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" ) @@ -4057,6 +4161,7 @@ atomic_int!(AtomicI64, i64, 8); any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" ) @@ -4073,6 +4178,7 @@ atomic_int!(AtomicI64, i64, 8); any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" ) @@ -4112,6 +4218,7 @@ atomic_int!(AtomicU64, u64, 8); cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -4121,6 +4228,7 @@ atomic_int!(AtomicU64, u64, 8); cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -4155,6 +4263,7 @@ atomic_int!(AtomicI128, i128, 16); cfg(any( not(portable_atomic_no_atomic_cas), portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" )) @@ -4164,6 +4273,7 @@ atomic_int!(AtomicI128, i128, 16); cfg(any( target_has_atomic = "ptr", portable_atomic_unsafe_assume_single_core, + feature = "critical-section", target_arch = "avr", target_arch = "msp430" ))