aboutsummaryrefslogtreecommitdiff
path: root/embassy-executor/src/raw/run_queue_atomics.rs
diff options
context:
space:
mode:
Diffstat (limited to 'embassy-executor/src/raw/run_queue_atomics.rs')
-rw-r--r--embassy-executor/src/raw/run_queue_atomics.rs19
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