diff options
author | 2021-11-02 13:41:12 +0100 | |
---|---|---|
committer | 2021-11-02 13:41:12 +0100 | |
commit | 8065d741aceb96ea06e70afce05408e334a977b5 (patch) | |
tree | bcba74ecf2bc4985a39cfdceee627b0742cb4820 /macros/src/codegen/timer_queue.rs | |
parent | b25d775771f7ecc4fdfc5a2faaeb52e63cc344c9 (diff) | |
download | rtic-8065d741aceb96ea06e70afce05408e334a977b5.tar.gz rtic-8065d741aceb96ea06e70afce05408e334a977b5.tar.zst rtic-8065d741aceb96ea06e70afce05408e334a977b5.zip |
Fixed aliasing issue due to RacyCell implementation
Diffstat (limited to 'macros/src/codegen/timer_queue.rs')
-rw-r--r-- | macros/src/codegen/timer_queue.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/macros/src/codegen/timer_queue.rs b/macros/src/codegen/timer_queue.rs index 896b3a83..2a344d25 100644 --- a/macros/src/codegen/timer_queue.rs +++ b/macros/src/codegen/timer_queue.rs @@ -117,7 +117,7 @@ pub fn codegen(app: &App, analysis: &Analysis, _extra: &Extra) -> Vec<TokenStrea quote!( #(#cfgs)* #t::#name => { - rtic::export::interrupt::free(|_| #rq.get_mut_unchecked().split().0.enqueue_unchecked((#rqt::#name, index))); + rtic::export::interrupt::free(|_| (&mut *#rq.get_mut()).split().0.enqueue_unchecked((#rqt::#name, index))); #pend } @@ -137,8 +137,8 @@ pub fn codegen(app: &App, analysis: &Analysis, _extra: &Extra) -> Vec<TokenStrea #[allow(non_snake_case)] unsafe fn #bound_interrupt() { while let Some((task, index)) = rtic::export::interrupt::free(|_| - if let Some(mono) = #m_ident.get_mut_unchecked().as_mut() { - #tq.get_mut_unchecked().dequeue(|| #disable_isr, mono) + if let Some(mono) = (&mut *#m_ident.get_mut()).as_mut() { + (&mut *#tq.get_mut()).dequeue(|| #disable_isr, mono) } else { // We can only use the timer queue if `init` has returned, and it // writes the `Some(monotonic)` we are accessing here. @@ -150,7 +150,7 @@ pub fn codegen(app: &App, analysis: &Analysis, _extra: &Extra) -> Vec<TokenStrea } } - rtic::export::interrupt::free(|_| if let Some(mono) = #m_ident.get_mut_unchecked().as_mut() { + rtic::export::interrupt::free(|_| if let Some(mono) = (&mut *#m_ident.get_mut()).as_mut() { mono.on_interrupt(); }); } |