free queue now with RacyCell

This commit is contained in:
Per Lindgren 2021-03-10 18:18:18 +01:00
parent b6c07ac1e4
commit 0dc2d52918
4 changed files with 4 additions and 4 deletions

View file

@ -87,7 +87,7 @@ pub fn codegen(app: &App, analysis: &Analysis, _extra: &Extra) -> Vec<TokenStrea
#t::#name => {
let #tupled =
#inputs.get_unchecked(usize::from(index)).as_ptr().read();
#fq.split().0.enqueue_unchecked(index);
#fq.get_mut_unchecked().split().0.enqueue_unchecked(index);
let priority = &rtic::export::Priority::new(PRIORITY);
#app_path::#name(
#locals_new

View file

@ -208,7 +208,7 @@ pub fn codegen(
let input = #tupled;
unsafe {
if let Some(index) = rtic::export::interrupt::free(|_| #app_path::#fq.dequeue()) {
if let Some(index) = rtic::export::interrupt::free(|_| #app_path::#fq.get_mut_unchecked().dequeue()) {
#app_path::#inputs
.get_unchecked_mut(usize::from(index))
.as_mut_ptr()

View file

@ -20,7 +20,7 @@ pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream
let fq_ident = util::mark_internal_ident(&fq_ident);
stmts.push(quote!(
(0..#cap).for_each(|i| #fq_ident.enqueue_unchecked(i));
(0..#cap).for_each(|i| #fq_ident.get_mut_unchecked().enqueue_unchecked(i));
));
}

View file

@ -52,7 +52,7 @@ pub fn codegen(
// /// Queue version of a free-list that keeps track of empty slots in
// /// the following buffers
#[doc(hidden)]
static mut #fq: #fq_ty = #fq_expr;
static #fq: rtic::RacyCell<#fq_ty> = rtic::RacyCell::new(#fq_expr);
));
let elems = &(0..cap)