diff options
author | 2023-01-04 20:29:16 +0100 | |
---|---|---|
committer | 2023-03-01 00:31:05 +0100 | |
commit | 5c3cedf69ad07cb8522a0b040bdbf1f9ca4cf37b (patch) | |
tree | 0d6346af0e61f32254648fca975aed1e8ebf8a9a /macros/src | |
parent | d27d0fe33fdb54e6a11a1e9d09a7916f19e5c9ec (diff) | |
download | rtic-5c3cedf69ad07cb8522a0b040bdbf1f9ca4cf37b.tar.gz rtic-5c3cedf69ad07cb8522a0b040bdbf1f9ca4cf37b.tar.zst rtic-5c3cedf69ad07cb8522a0b040bdbf1f9ca4cf37b.zip |
Fix fences
Diffstat (limited to 'macros/src')
-rw-r--r-- | macros/src/codegen/async_dispatchers.rs | 5 | ||||
-rw-r--r-- | macros/src/codegen/module.rs | 10 |
2 files changed, 7 insertions, 8 deletions
diff --git a/macros/src/codegen/async_dispatchers.rs b/macros/src/codegen/async_dispatchers.rs index aa854d7f..c8116654 100644 --- a/macros/src/codegen/async_dispatchers.rs +++ b/macros/src/codegen/async_dispatchers.rs @@ -101,7 +101,12 @@ pub fn codegen(app: &App, analysis: &Analysis) -> Vec<TokenStream2> { const PRIORITY: u8 = #level; rtic::export::run(PRIORITY, || { + // Have the acquire/release semantics outside the checks to no overdo it + core::sync::atomic::fence(core::sync::atomic::Ordering::Acquire); + #(#stmts)* + + core::sync::atomic::fence(core::sync::atomic::Ordering::Release); }); } )); diff --git a/macros/src/codegen/module.rs b/macros/src/codegen/module.rs index eb0cb65b..b4ad68aa 100644 --- a/macros/src/codegen/module.rs +++ b/macros/src/codegen/module.rs @@ -111,14 +111,8 @@ pub fn codegen( let v = Vec::new(); let cfgs = match ctxt { - Context::HardwareTask(t) => { - &app.hardware_tasks[t].cfgs - // ... - } - Context::SoftwareTask(t) => { - &app.software_tasks[t].cfgs - // ... - } + Context::HardwareTask(t) => &app.hardware_tasks[t].cfgs, + Context::SoftwareTask(t) => &app.software_tasks[t].cfgs, _ => &v, }; |