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)*
#t::#name => {
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);
let priority = &rtic::export::Priority::new(PRIORITY);
#app_path::#name(

View file

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

View file

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