mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-19 06:15:45 +01:00
wip1
This commit is contained in:
parent
cfd5f4785e
commit
3c208003f5
4 changed files with 322 additions and 2 deletions
|
|
@ -83,6 +83,7 @@ pub fn codegen(
|
|||
#cfg_core
|
||||
pub struct #name<'a> {
|
||||
priority: &'a Priority,
|
||||
locked: Cell<bool>,
|
||||
}
|
||||
|
||||
#(#cfgs)*
|
||||
|
|
@ -90,13 +91,25 @@ pub fn codegen(
|
|||
impl<'a> #name<'a> {
|
||||
#[inline(always)]
|
||||
pub unsafe fn new(priority: &'a Priority) -> Self {
|
||||
#name { priority }
|
||||
#name {
|
||||
priority,
|
||||
locked: Cell::new(false),
|
||||
}
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub unsafe fn priority(&self) -> &Priority {
|
||||
self.priority
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub unsafe fn is_locked(&self) -> bool {
|
||||
self.locked.get()
|
||||
}
|
||||
|
||||
pub unsafe fn lock(&self) {
|
||||
self.locked.set(true);
|
||||
}
|
||||
}
|
||||
));
|
||||
|
||||
|
|
@ -130,7 +143,7 @@ pub fn codegen(
|
|||
} else {
|
||||
quote!(mod resources {
|
||||
use rtic::export::Priority;
|
||||
|
||||
use core::cell::Cell;
|
||||
#(#mod_resources)*
|
||||
})
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue