aboutsummaryrefslogtreecommitdiff
path: root/macros/src/codegen/timer_queue.rs
diff options
context:
space:
mode:
authorGravatar bors[bot] <26634292+bors[bot]@users.noreply.github.com> 2021-11-03 08:45:53 +0000
committerGravatar GitHub <noreply@github.com> 2021-11-03 08:45:53 +0000
commit7155b55ac8ff4e5f8860bd6f81c39d31756af633 (patch)
tree82d4de23a49ece531207b2ac065e371bb9fd20f1 /macros/src/codegen/timer_queue.rs
parentb25d775771f7ecc4fdfc5a2faaeb52e63cc344c9 (diff)
parent9e24fcbbd90609a25b9d985f9292900b476fe5ea (diff)
downloadrtic-7155b55ac8ff4e5f8860bd6f81c39d31756af633.tar.gz
rtic-7155b55ac8ff4e5f8860bd6f81c39d31756af633.tar.zst
rtic-7155b55ac8ff4e5f8860bd6f81c39d31756af633.zip
Merge #548
548: Fixed aliasing issue due to RacyCell implementation r=perlindgren a=korken89 Co-authored-by: Emil Fresk <emil.fresk@gmail.com> Co-authored-by: Per Lindgren <per.lindgren@ltu.se>
Diffstat (limited to 'macros/src/codegen/timer_queue.rs')
-rw-r--r--macros/src/codegen/timer_queue.rs8
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();
});
}