diff options
| author | diondokter <[email protected]> | 2025-08-29 14:36:17 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2025-09-11 14:45:27 +0200 |
| commit | 52d178560501a464dba67da89a1570ae9a2cf66c (patch) | |
| tree | 285b11fe4f91a77789f649377e431414e43f7ac2 /embassy-executor/src/metadata.rs | |
| parent | d6d4df1c768f8ae43ad1339b74d351f4cbad0386 (diff) | |
Introduce metadata-deadline and let the EDF scheduler use it
Diffstat (limited to 'embassy-executor/src/metadata.rs')
| -rw-r--r-- | embassy-executor/src/metadata.rs | 13 |
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; | |||
| 12 | pub struct Metadata { | 12 | pub 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 | ||
| 17 | impl Metadata { | 19 | impl 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 | } |
