mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-29 15:04:32 +01:00
task_lockal wip
This commit is contained in:
parent
1f8b4f651e
commit
fc1c9bda3f
3 changed files with 6 additions and 3 deletions
|
@ -50,7 +50,7 @@ pub fn codegen(
|
|||
items.push(quote!(
|
||||
#(#cfgs)*
|
||||
#[doc(hidden)]
|
||||
static mut #name: #ty = #expr
|
||||
static #name: rtic::RacyCell<#ty> = rtic::RacyCell::new(#expr)
|
||||
));
|
||||
values.push(quote!(
|
||||
#(#cfgs)*
|
||||
|
@ -64,7 +64,7 @@ pub fn codegen(
|
|||
}
|
||||
|
||||
if lt.is_some() && has_cfgs {
|
||||
fields.push(quote!(__marker__: core::marker::PhantomData<&'a mut ()>));
|
||||
fields.push(quote!(__marker__: core::marker::PhantomData<&'a ()>));
|
||||
values.push(quote!(__marker__: core::marker::PhantomData));
|
||||
}
|
||||
|
||||
|
|
|
@ -66,8 +66,11 @@ pub fn codegen(
|
|||
}
|
||||
|
||||
let r_prop = &res.properties;
|
||||
let doc = format!(" RTIC internal: {}:{}", file!(), line!());
|
||||
|
||||
if !r_prop.task_local && !r_prop.lock_free {
|
||||
mod_resources.push(quote!(
|
||||
#[doc = #doc]
|
||||
#[allow(non_camel_case_types)]
|
||||
#(#cfgs)*
|
||||
pub struct #name<'a> {
|
||||
|
|
|
@ -79,7 +79,7 @@ pub fn codegen(ctxt: Context, needs_lt: &mut bool, app: &App) -> (TokenStream2,
|
|||
let is_late = expr.is_none();
|
||||
if is_late {
|
||||
let expr = if access.is_exclusive() {
|
||||
quote!(&mut *#mangled_name.as_mut_ptr())
|
||||
quote!(&mut *#mangled_name.get_mut_unchecked().as_mut_ptr())
|
||||
} else {
|
||||
quote!(&*#mangled_name.as_ptr())
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue