Skip to content

Commit 4b66f0a

Browse files
committed
Use atomic-polyfill for AtomicCheckMutex
This will allow using shared-bus on thumbv6 platforms which do not have real atomics.
1 parent 0f42943 commit 4b66f0a

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ once_cell = { version = "1.4.0", optional = true }
2222
cortex-m = { version = "0.6.3", optional = true }
2323
xtensa-lx = { version = "0.6.0", optional = true }
2424
spin = { version = "0.9.2", optional = true }
25+
atomic-polyfill = "0.1.6"
2526

2627
[dev-dependencies]
2728
embedded-hal-mock = "0.8"

src/mutex.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ mod tests {
184184
#[derive(Debug)]
185185
pub struct AtomicCheckMutex<BUS> {
186186
bus: core::cell::UnsafeCell<BUS>,
187-
busy: core::sync::atomic::AtomicBool,
187+
busy: atomic_polyfill::AtomicBool,
188188
}
189189

190190
// It is explicitly safe to share this across threads because there is a coherency check using an
@@ -199,7 +199,7 @@ impl<BUS> BusMutex for AtomicCheckMutex<BUS> {
199199
fn create(v: BUS) -> Self {
200200
Self {
201201
bus: core::cell::UnsafeCell::new(v),
202-
busy: core::sync::atomic::AtomicBool::from(false),
202+
busy: atomic_polyfill::AtomicBool::from(false),
203203
}
204204
}
205205

0 commit comments

Comments
 (0)