File tree Expand file tree Collapse file tree 4 files changed +18
-14
lines changed Expand file tree Collapse file tree 4 files changed +18
-14
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ __trybuild = []
3232[target .x86_64-unknown-linux-gnu .dev-dependencies ]
3333scoped_threadpool = " 0.1.8"
3434
35+ [target .thumbv6m-none-eabi .dependencies ]
36+ atomic-polyfill = " 0.1.2"
37+
3538[dependencies ]
3639hash32 = " 0.1.0"
3740
Original file line number Diff line number Diff line change @@ -24,10 +24,7 @@ fn main() -> Result<(), Box<dyn Error>> {
2424 // built-in targets with no atomic / CAS support as of nightly-2019-12-17
2525 // see the `no-atomics.sh` / `no-cas.sh` script sitting next to this file
2626 match & target[ ..] {
27- "thumbv6m-none-eabi"
28- | "msp430-none-elf"
29- | "riscv32i-unknown-none-elf"
30- | "riscv32imc-unknown-none-elf" => { }
27+ "msp430-none-elf" | "riscv32i-unknown-none-elf" | "riscv32imc-unknown-none-elf" => { }
3128
3229 _ => {
3330 println ! ( "cargo:rustc-cfg=has_cas" ) ;
Original file line number Diff line number Diff line change 8282//!
8383//! [0]: http://www.1024cores.net/home/lock-free-algorithms/queues/bounded-mpmc-queue
8484
85- use core:: {
86- cell:: UnsafeCell ,
87- mem:: MaybeUninit ,
88- sync:: atomic:: { AtomicU8 , Ordering } ,
89- } ;
85+ use core:: { cell:: UnsafeCell , mem:: MaybeUninit } ;
86+
87+ #[ cfg( armv6m) ]
88+ use atomic_polyfill:: { AtomicU8 , Ordering } ;
89+
90+ #[ cfg( not( armv6m) ) ]
91+ use core:: sync:: atomic:: { AtomicU8 , Ordering } ;
9092
9193/// MPMC queue with a capacity for 2 elements
9294pub struct Q2 < T > {
Original file line number Diff line number Diff line change 11//! Stack based on LL/SC atomics
22
33pub use core:: ptr:: NonNull as Ptr ;
4- use core:: {
5- cell:: UnsafeCell ,
6- ptr,
7- sync:: atomic:: { AtomicPtr , Ordering } ,
8- } ;
4+ use core:: { cell:: UnsafeCell , ptr} ;
5+
6+ #[ cfg( armv6m) ]
7+ use atomic_polyfill:: { AtomicPtr , Ordering } ;
8+
9+ #[ cfg( not( armv6m) ) ]
10+ use core:: sync:: atomic:: { AtomicPtr , Ordering } ;
911
1012/// Unfortunate implementation detail required to use the
1113/// [`Pool.grow_exact`](struct.Pool.html#method.grow_exact) method
You can’t perform that action at this time.
0 commit comments