mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-26 05:29:38 +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!(
|
items.push(quote!(
|
||||||
#(#cfgs)*
|
#(#cfgs)*
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
static mut #name: #ty = #expr
|
static #name: rtic::RacyCell<#ty> = rtic::RacyCell::new(#expr)
|
||||||
));
|
));
|
||||||
values.push(quote!(
|
values.push(quote!(
|
||||||
#(#cfgs)*
|
#(#cfgs)*
|
||||||
|
@ -64,7 +64,7 @@ pub fn codegen(
|
||||||
}
|
}
|
||||||
|
|
||||||
if lt.is_some() && has_cfgs {
|
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));
|
values.push(quote!(__marker__: core::marker::PhantomData));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,8 +66,11 @@ pub fn codegen(
|
||||||
}
|
}
|
||||||
|
|
||||||
let r_prop = &res.properties;
|
let r_prop = &res.properties;
|
||||||
|
let doc = format!(" RTIC internal: {}:{}", file!(), line!());
|
||||||
|
|
||||||
if !r_prop.task_local && !r_prop.lock_free {
|
if !r_prop.task_local && !r_prop.lock_free {
|
||||||
mod_resources.push(quote!(
|
mod_resources.push(quote!(
|
||||||
|
#[doc = #doc]
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
#(#cfgs)*
|
#(#cfgs)*
|
||||||
pub struct #name<'a> {
|
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();
|
let is_late = expr.is_none();
|
||||||
if is_late {
|
if is_late {
|
||||||
let expr = if access.is_exclusive() {
|
let expr = if access.is_exclusive() {
|
||||||
quote!(&mut *#mangled_name.as_mut_ptr())
|
quote!(&mut *#mangled_name.get_mut_unchecked().as_mut_ptr())
|
||||||
} else {
|
} else {
|
||||||
quote!(&*#mangled_name.as_ptr())
|
quote!(&*#mangled_name.as_ptr())
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue