mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-27 14:04:56 +01:00
free queue now with RacyCell
This commit is contained in:
parent
b6c07ac1e4
commit
0dc2d52918
4 changed files with 4 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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));
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue