Skip to content

Commit 94eaa79

Browse files
committed
rtic-sync: introduce loom compat layer and apply it to channel
1 parent e6bd030 commit 94eaa79

File tree

7 files changed

+301
-89
lines changed

7 files changed

+301
-89
lines changed

rtic-sync/Cargo.toml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,23 @@ portable-atomic = { version = "1", default-features = false }
2525
embedded-hal = { version = "1.0.0" }
2626
embedded-hal-async = { version = "1.0.0" }
2727
embedded-hal-bus = { version = "0.2.0", features = ["async"] }
28-
2928
defmt-03 = { package = "defmt", version = "0.3", optional = true }
3029

3130
[dev-dependencies]
3231
cassette = "0.3.0"
3332
static_cell = "2.1.0"
34-
tokio = { version = "1", features = ["rt", "macros", "time"] }
33+
34+
[target.'cfg(not(loom))'.dev-dependencies]
35+
tokio = { version = "1", features = ["rt", "macros", "time"], default-features = false }
3536

3637
[features]
3738
default = []
38-
testing = ["critical-section/std", "rtic-common/testing"]
39+
testing = ["rtic-common/testing"]
3940
defmt-03 = ["dep:defmt-03", "embedded-hal/defmt-03", "embedded-hal-async/defmt-03", "embedded-hal-bus/defmt-03"]
41+
42+
[lints.rust]
43+
unexpected_cfgs = { level = "allow", check-cfg = ['cfg(loom)'] }
44+
45+
[target.'cfg(loom)'.dependencies]
46+
loom = { version = "0.7.2", features = [ "futures" ] }
47+
critical-section = { version = "1", features = [ "restore-state-bool" ] }

rtic-sync/src/arbiter.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,9 @@ pub mod i2c {
381381
}
382382
}
383383

384+
#[cfg(not(loom))]
384385
#[cfg(test)]
385-
mod tests {
386+
mod tokio_tests {
386387
use super::*;
387388

388389
#[tokio::test]

0 commit comments

Comments
 (0)