diff options
| author | James Munns <[email protected]> | 2025-04-01 19:32:12 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2025-09-11 14:45:06 +0200 |
| commit | ed2e51bfa4f92b422233343a0c5b1af98fb36537 (patch) | |
| tree | 481133e93d5eb8f2017c9e308220e24007a58c04 /embassy-executor/src/raw/mod.rs | |
| parent | ba0426f767bb602750bed4fae87a156b661c0e92 (diff) | |
Dependency enablement trickery
Diffstat (limited to 'embassy-executor/src/raw/mod.rs')
| -rw-r--r-- | embassy-executor/src/raw/mod.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/embassy-executor/src/raw/mod.rs b/embassy-executor/src/raw/mod.rs index 0dd247d30..f4fbe1bfc 100644 --- a/embassy-executor/src/raw/mod.rs +++ b/embassy-executor/src/raw/mod.rs | |||
| @@ -101,14 +101,14 @@ extern "Rust" fn __embassy_time_queue_item_from_waker(waker: &Waker) -> &'static | |||
| 101 | /// - 5: Task is dequeued. The task's future is not polled, because exiting the task replaces its `poll_fn`. | 101 | /// - 5: Task is dequeued. The task's future is not polled, because exiting the task replaces its `poll_fn`. |
| 102 | /// - 6: A task is waken when it is not spawned - `wake_task -> State::run_enqueue` | 102 | /// - 6: A task is waken when it is not spawned - `wake_task -> State::run_enqueue` |
| 103 | pub(crate) struct TaskHeader { | 103 | pub(crate) struct TaskHeader { |
| 104 | pub(crate) state: State, | ||
| 104 | pub(crate) run_queue_item: RunQueueItem, | 105 | pub(crate) run_queue_item: RunQueueItem, |
| 105 | 106 | ||
| 106 | #[cfg(feature = "drs-scheduler")] | ||
| 107 | /// Deadline Rank Scheduler Deadline. This field should not be accessed outside the context of | 107 | /// Deadline Rank Scheduler Deadline. This field should not be accessed outside the context of |
| 108 | /// the task itself as it being polled by the executor. | 108 | /// the task itself as it being polled by the executor. |
| 109 | #[cfg(feature = "drs-scheduler")] | ||
| 109 | pub(crate) deadline: SyncUnsafeCell<u64>, | 110 | pub(crate) deadline: SyncUnsafeCell<u64>, |
| 110 | 111 | ||
| 111 | pub(crate) state: State, | ||
| 112 | pub(crate) executor: AtomicPtr<SyncExecutor>, | 112 | pub(crate) executor: AtomicPtr<SyncExecutor>, |
| 113 | poll_fn: SyncUnsafeCell<Option<unsafe fn(TaskRef)>>, | 113 | poll_fn: SyncUnsafeCell<Option<unsafe fn(TaskRef)>>, |
| 114 | 114 | ||
| @@ -211,10 +211,12 @@ impl<F: Future + 'static> TaskStorage<F> { | |||
| 211 | pub const fn new() -> Self { | 211 | pub const fn new() -> Self { |
| 212 | Self { | 212 | Self { |
| 213 | raw: TaskHeader { | 213 | raw: TaskHeader { |
| 214 | state: State::new(), | ||
| 214 | run_queue_item: RunQueueItem::new(), | 215 | run_queue_item: RunQueueItem::new(), |
| 216 | // NOTE: The deadline is set to zero to allow the initializer to reside in `.bss`. This | ||
| 217 | // will be lazily initalized in `initialize_impl` | ||
| 215 | #[cfg(feature = "drs-scheduler")] | 218 | #[cfg(feature = "drs-scheduler")] |
| 216 | deadline: SyncUnsafeCell::new(0u64), | 219 | deadline: SyncUnsafeCell::new(0u64), |
| 217 | state: State::new(), | ||
| 218 | executor: AtomicPtr::new(core::ptr::null_mut()), | 220 | executor: AtomicPtr::new(core::ptr::null_mut()), |
| 219 | // Note: this is lazily initialized so that a static `TaskStorage` will go in `.bss` | 221 | // Note: this is lazily initialized so that a static `TaskStorage` will go in `.bss` |
| 220 | poll_fn: SyncUnsafeCell::new(None), | 222 | poll_fn: SyncUnsafeCell::new(None), |
| @@ -311,7 +313,8 @@ impl<F: Future + 'static> AvailableTask<F> { | |||
| 311 | self.task.raw.poll_fn.set(Some(TaskStorage::<F>::poll)); | 313 | self.task.raw.poll_fn.set(Some(TaskStorage::<F>::poll)); |
| 312 | self.task.future.write_in_place(future); | 314 | self.task.future.write_in_place(future); |
| 313 | 315 | ||
| 314 | // TODO(AJM): Some other way of setting this? Just a placeholder | 316 | // By default, deadlines are set to the maximum value, so that any task WITH |
| 317 | // a set deadline will ALWAYS be scheduled BEFORE a task WITHOUT a set deadline | ||
| 315 | #[cfg(feature = "drs-scheduler")] | 318 | #[cfg(feature = "drs-scheduler")] |
| 316 | self.task.raw.deadline.set(u64::MAX); | 319 | self.task.raw.deadline.set(u64::MAX); |
| 317 | 320 | ||
