aboutsummaryrefslogtreecommitdiff
path: root/macros/src
diff options
context:
space:
mode:
authorGravatar Jorge Aparicio <jorge@japaric.io> 2017-07-26 19:30:47 -0500
committerGravatar Jorge Aparicio <jorge@japaric.io> 2017-07-26 19:30:47 -0500
commitdee2fcde716a2dbb1404caa4e0f8f4ce11c472c8 (patch)
tree2432722f2332e7d0a5bfa659e544e246d30d8057 /macros/src
parent4a1509cb53d9b8a33c17264fa54cca8886788073 (diff)
downloadrtic-dee2fcde716a2dbb1404caa4e0f8f4ce11c472c8.tar.gz
rtic-dee2fcde716a2dbb1404caa4e0f8f4ce11c472c8.tar.zst
rtic-dee2fcde716a2dbb1404caa4e0f8f4ce11c472c8.zip
provide a Threshold token even when all resources are lockless
because the token will always be required for calling generic functions
Diffstat (limited to 'macros/src')
-rw-r--r--macros/src/trans.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/macros/src/trans.rs b/macros/src/trans.rs
index 6554dc9f..a137e0ec 100644
--- a/macros/src/trans.rs
+++ b/macros/src/trans.rs
@@ -59,12 +59,7 @@ fn idle(
let mut tys = vec![];
let mut exprs = vec![];
- if !app.idle.resources.is_empty() &&
- !app.idle
- .resources
- .iter()
- .all(|resource| ownerships[resource].is_owned())
- {
+ if !app.idle.resources.is_empty() {
tys.push(quote!(&mut #krate::Threshold));
exprs.push(quote!(unsafe { &mut #krate::Threshold::new(0) }));
}
@@ -508,6 +503,8 @@ fn tasks(app: &App, ownerships: &Ownerships, root: &mut Vec<Tokens>) {
let has_resources = !task.resources.is_empty();
if has_resources {
+ needs_threshold = !task.resources.is_empty();
+
for name in &task.resources {
let _name = Ident::new(format!("_{}", name.as_ref()));
@@ -606,7 +603,8 @@ fn tasks(app: &App, ownerships: &Ownerships, root: &mut Vec<Tokens>) {
}
let _name = Ident::new(format!("_{}", name));
- let export_name = Lit::Str(name.as_ref().to_owned(), StrStyle::Cooked);
+ let export_name =
+ Lit::Str(name.as_ref().to_owned(), StrStyle::Cooked);
root.push(quote! {
#[allow(non_snake_case)]
#[allow(unsafe_code)]