From b6c07ac1e47ecc1a048155bd45eaed16a28fb409 Mon Sep 17 00:00:00 2001 From: Per Lindgren Date: Wed, 10 Mar 2021 17:39:44 +0100 Subject: [PATCH] ready queue now with RacyCell --- macros/src/codegen/dispatchers.rs | 4 ++-- macros/src/codegen/module.rs | 2 +- src/lib.rs | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/macros/src/codegen/dispatchers.rs b/macros/src/codegen/dispatchers.rs index dc33b1af60..1002c14589 100644 --- a/macros/src/codegen/dispatchers.rs +++ b/macros/src/codegen/dispatchers.rs @@ -59,7 +59,7 @@ pub fn codegen(app: &App, analysis: &Analysis, _extra: &Extra) -> Vec = rtic::RacyCell::new(#rq_expr); )); let arms = channel @@ -100,7 +100,7 @@ pub fn codegen(app: &App, analysis: &Analysis, _extra: &Extra) -> Vec>(); stmts.push(quote!( - while let Some((task, index)) = #rq.split().1.dequeue() { + while let Some((task, index)) = #rq.get_mut_unchecked().split().1.dequeue() { match task { #(#arms)* } diff --git a/macros/src/codegen/module.rs b/macros/src/codegen/module.rs index 75435b549e..5a66408320 100644 --- a/macros/src/codegen/module.rs +++ b/macros/src/codegen/module.rs @@ -215,7 +215,7 @@ pub fn codegen( .write(input); rtic::export::interrupt::free(|_| { - #app_path::#rq.enqueue_unchecked((#app_path::#t::#name, index)); + #app_path::#rq.get_mut_unchecked().enqueue_unchecked((#app_path::#t::#name, index)); }); rtic::pend(#device::#enum_::#interrupt); diff --git a/src/lib.rs b/src/lib.rs index 2da2ec9583..72e4939631 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -75,4 +75,5 @@ impl RacyCell { } // The type wrapped need to be Sync for RacyCell to be Sync -unsafe impl Sync for RacyCell where T: Sync {} +//unsafe impl Sync for RacyCell where T: Sync {} +unsafe impl Sync for RacyCell {}