aboutsummaryrefslogtreecommitdiff
path: root/embassy-executor/src/metadata.rs
diff options
context:
space:
mode:
Diffstat (limited to 'embassy-executor/src/metadata.rs')
-rw-r--r--embassy-executor/src/metadata.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/embassy-executor/src/metadata.rs b/embassy-executor/src/metadata.rs
index f92c9b37c..fd8095629 100644
--- a/embassy-executor/src/metadata.rs
+++ b/embassy-executor/src/metadata.rs
@@ -12,6 +12,8 @@ use crate::raw;
12pub struct Metadata { 12pub struct Metadata {
13 #[cfg(feature = "metadata-name")] 13 #[cfg(feature = "metadata-name")]
14 name: Mutex<Cell<Option<&'static str>>>, 14 name: Mutex<Cell<Option<&'static str>>>,
15 #[cfg(feature = "metadata-deadline")]
16 deadline: raw::Deadline,
15} 17}
16 18
17impl Metadata { 19impl Metadata {
@@ -19,6 +21,10 @@ impl Metadata {
19 Self { 21 Self {
20 #[cfg(feature = "metadata-name")] 22 #[cfg(feature = "metadata-name")]
21 name: Mutex::new(Cell::new(None)), 23 name: Mutex::new(Cell::new(None)),
24 // NOTE: The deadline is set to zero to allow the initializer to reside in `.bss`. This
25 // will be lazily initalized in `initialize_impl`
26 #[cfg(feature = "metadata-deadline")]
27 deadline: raw::Deadline::new_unset(),
22 } 28 }
23 } 29 }
24 30
@@ -52,4 +58,11 @@ impl Metadata {
52 pub fn set_name(&self, name: &'static str) { 58 pub fn set_name(&self, name: &'static str) {
53 critical_section::with(|cs| self.name.borrow(cs).set(Some(name))) 59 critical_section::with(|cs| self.name.borrow(cs).set(Some(name)))
54 } 60 }
61
62 /// Earliest Deadline First scheduler Deadline. This field should not be accessed
63 /// outside the context of the task itself as it being polled by the executor.
64 #[cfg(feature = "metadata-deadline")]
65 pub fn deadline(&self) -> &raw::Deadline {
66 &self.deadline
67 }
55} 68}