mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-23 20:22:51 +01:00
ready queue now with RacyCell
This commit is contained in:
parent
db1574bf6b
commit
b6c07ac1e4
3 changed files with 5 additions and 4 deletions
|
@ -59,7 +59,7 @@ pub fn codegen(app: &App, analysis: &Analysis, _extra: &Extra) -> Vec<TokenStrea
|
||||||
// );
|
// );
|
||||||
items.push(quote!(
|
items.push(quote!(
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
static mut #rq: #rq_ty = #rq_expr;
|
static #rq: rtic::RacyCell<#rq_ty> = rtic::RacyCell::new(#rq_expr);
|
||||||
));
|
));
|
||||||
|
|
||||||
let arms = channel
|
let arms = channel
|
||||||
|
@ -100,7 +100,7 @@ pub fn codegen(app: &App, analysis: &Analysis, _extra: &Extra) -> Vec<TokenStrea
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
stmts.push(quote!(
|
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 {
|
match task {
|
||||||
#(#arms)*
|
#(#arms)*
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,7 +215,7 @@ pub fn codegen(
|
||||||
.write(input);
|
.write(input);
|
||||||
|
|
||||||
rtic::export::interrupt::free(|_| {
|
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);
|
rtic::pend(#device::#enum_::#interrupt);
|
||||||
|
|
|
@ -75,4 +75,5 @@ impl<T> RacyCell<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// The type wrapped need to be Sync for RacyCell<T> to be Sync
|
// The type wrapped need to be Sync for RacyCell<T> to be Sync
|
||||||
unsafe impl<T> Sync for RacyCell<T> where T: Sync {}
|
//unsafe impl<T> Sync for RacyCell<T> where T: Sync {}
|
||||||
|
unsafe impl<T> Sync for RacyCell<T> {}
|
||||||
|
|
Loading…
Reference in a new issue