enable Atomic*.{load,store} for ARMv6-M / MSP430
closes #45085 this commit adds an `atomic_cas` target option and an unstable `#[cfg(target_has_atomic_cas)]` attribute to enable a subset of the `Atomic*` API on architectures that don't support atomic CAS natively, like MSP430 and ARMv6-M.
This commit is contained in:
@@ -12,10 +12,12 @@
|
||||
|
||||
pub use core::task::*;
|
||||
|
||||
#[cfg(target_has_atomic = "ptr")]
|
||||
#[cfg_attr(stage0, cfg(target_has_atomic = "ptr"))]
|
||||
#[cfg_attr(not(stage0), cfg(all(target_has_atomic = "ptr", target_has_atomic_cas)))]
|
||||
pub use self::if_arc::*;
|
||||
|
||||
#[cfg(target_has_atomic = "ptr")]
|
||||
#[cfg_attr(stage0, cfg(target_has_atomic = "ptr"))]
|
||||
#[cfg_attr(not(stage0), cfg(all(target_has_atomic = "ptr", target_has_atomic_cas)))]
|
||||
mod if_arc {
|
||||
use super::*;
|
||||
use core::marker::PhantomData;
|
||||
@@ -47,7 +49,8 @@ mod if_arc {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_has_atomic = "ptr")]
|
||||
#[cfg_attr(stage0, cfg(target_has_atomic = "ptr"))]
|
||||
#[cfg_attr(not(stage0), cfg(all(target_has_atomic = "ptr", target_has_atomic_cas)))]
|
||||
struct ArcWrapped<T>(PhantomData<T>);
|
||||
|
||||
unsafe impl<T: Wake + 'static> UnsafeWake for ArcWrapped<T> {
|
||||
|
||||
Reference in New Issue
Block a user