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 = []
32
32
[target .x86_64-unknown-linux-gnu .dev-dependencies ]
33
33
scoped_threadpool = " 0.1.8"
34
34
35
+ [target .thumbv6m-none-eabi .dependencies ]
36
+ atomic-polyfill = " 0.1.2"
37
+
35
38
[dependencies ]
36
39
hash32 = " 0.1.0"
37
40
Original file line number Diff line number Diff line change @@ -24,10 +24,7 @@ fn main() -> Result<(), Box<dyn Error>> {
24
24
// built-in targets with no atomic / CAS support as of nightly-2019-12-17
25
25
// see the `no-atomics.sh` / `no-cas.sh` script sitting next to this file
26
26
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" => { }
31
28
32
29
_ => {
33
30
println ! ( "cargo:rustc-cfg=has_cas" ) ;
Original file line number Diff line number Diff line change 82
82
//!
83
83
//! [0]: http://www.1024cores.net/home/lock-free-algorithms/queues/bounded-mpmc-queue
84
84
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 } ;
90
92
91
93
/// MPMC queue with a capacity for 2 elements
92
94
pub struct Q2 < T > {
Original file line number Diff line number Diff line change 1
1
//! Stack based on LL/SC atomics
2
2
3
3
pub 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 } ;
9
11
10
12
/// Unfortunate implementation detail required to use the
11
13
/// [`Pool.grow_exact`](struct.Pool.html#method.grow_exact) method
You can’t perform that action at this time.
0 commit comments