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/run_queue_atomics.rs | |
| parent | ba0426f767bb602750bed4fae87a156b661c0e92 (diff) | |
Dependency enablement trickery
Diffstat (limited to 'embassy-executor/src/raw/run_queue_atomics.rs')
| -rw-r--r-- | embassy-executor/src/raw/run_queue_atomics.rs | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/embassy-executor/src/raw/run_queue_atomics.rs b/embassy-executor/src/raw/run_queue_atomics.rs index bc5d38250..3715fc658 100644 --- a/embassy-executor/src/raw/run_queue_atomics.rs +++ b/embassy-executor/src/raw/run_queue_atomics.rs | |||
| @@ -66,6 +66,8 @@ impl RunQueue { | |||
| 66 | self.stack.push_was_empty(task) | 66 | self.stack.push_was_empty(task) |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | /// # Standard atomic runqueue | ||
| 70 | /// | ||
| 69 | /// Empty the queue, then call `on_task` for each task that was in the queue. | 71 | /// Empty the queue, then call `on_task` for each task that was in the queue. |
| 70 | /// NOTE: It is OK for `on_task` to enqueue more tasks. In this case they're left in the queue | 72 | /// NOTE: It is OK for `on_task` to enqueue more tasks. In this case they're left in the queue |
| 71 | /// and will be processed by the *next* call to `dequeue_all`, *not* the current one. | 73 | /// and will be processed by the *next* call to `dequeue_all`, *not* the current one. |
| @@ -78,9 +80,20 @@ impl RunQueue { | |||
| 78 | } | 80 | } |
| 79 | } | 81 | } |
| 80 | 82 | ||
| 81 | /// Empty the queue, then call `on_task` for each task that was in the queue. | 83 | /// # Deadline Ranked Sorted Scheduler |
| 82 | /// NOTE: It is OK for `on_task` to enqueue more tasks. In this case they're left in the queue | 84 | /// |
| 83 | /// and will be processed by the *next* call to `dequeue_all`, *not* the current one. | 85 | /// This algorithm will loop until all enqueued tasks are processed. |
| 86 | /// | ||
| 87 | /// Before polling a task, all currently enqueued tasks will be popped from the | ||
| 88 | /// runqueue, and will be added to the working `sorted` list, a linked-list that | ||
| 89 | /// sorts tasks by their deadline, with nearest deadline items in the front, and | ||
| 90 | /// furthest deadline items in the back. | ||
| 91 | /// | ||
| 92 | /// After popping and sorting all pending tasks, the SOONEST task will be popped | ||
| 93 | /// from the front of the queue, and polled by calling `on_task` on it. | ||
| 94 | /// | ||
| 95 | /// This process will repeat until the local `sorted` queue AND the global | ||
| 96 | /// runqueue are both empty, at which point this function will return. | ||
| 84 | #[cfg(feature = "drs-scheduler")] | 97 | #[cfg(feature = "drs-scheduler")] |
| 85 | pub(crate) fn dequeue_all(&self, on_task: impl Fn(TaskRef)) { | 98 | pub(crate) fn dequeue_all(&self, on_task: impl Fn(TaskRef)) { |
| 86 | // SAFETY: `deadline` can only be set through the `Deadline` interface, which | 99 | // SAFETY: `deadline` can only be set through the `Deadline` interface, which |
