RacyCell inputs

This commit is contained in:
Per Lindgren 2021-03-11 01:48:33 +01:00
parent 0dc2d52918
commit c70191c019
3 changed files with 8 additions and 3 deletions

View file

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

View file

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

View file

@ -82,8 +82,8 @@ pub fn codegen(
#uninit #uninit
// /// Buffer that holds the inputs of a task // /// Buffer that holds the inputs of a task
#[doc(hidden)] #[doc(hidden)]
static mut #inputs_ident: [core::mem::MaybeUninit<#input_ty>; #cap_lit] = static #inputs_ident: rtic::RacyCell<[core::mem::MaybeUninit<#input_ty>; #cap_lit]> =
[#(#elems,)*]; rtic::RacyCell::new([#(#elems,)*]);
)); ));
// `${task}Resources` // `${task}Resources`