diff options
| author | Dániel Buga <[email protected]> | 2024-12-16 19:03:00 +0100 |
|---|---|---|
| committer | Dániel Buga <[email protected]> | 2024-12-16 20:37:02 +0100 |
| commit | c90d048ecb611908f5696b4f57d689bdb254aee6 (patch) | |
| tree | 9800ad14610b683b0d5048f89e84a3d835822171 /embassy-executor/src/raw/state_critical_section.rs | |
| parent | a8617429e4c3177a3e7c31b20ee36a2dfe6b6430 (diff) | |
Remove TIMER_QUEUED
Diffstat (limited to 'embassy-executor/src/raw/state_critical_section.rs')
| -rw-r--r-- | embassy-executor/src/raw/state_critical_section.rs | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/embassy-executor/src/raw/state_critical_section.rs b/embassy-executor/src/raw/state_critical_section.rs index 8e570b33c..29b10f6e3 100644 --- a/embassy-executor/src/raw/state_critical_section.rs +++ b/embassy-executor/src/raw/state_critical_section.rs | |||
| @@ -3,14 +3,10 @@ use core::cell::Cell; | |||
| 3 | pub(crate) use critical_section::{with as locked, CriticalSection as Token}; | 3 | pub(crate) use critical_section::{with as locked, CriticalSection as Token}; |
| 4 | use critical_section::{CriticalSection, Mutex}; | 4 | use critical_section::{CriticalSection, Mutex}; |
| 5 | 5 | ||
| 6 | use super::timer_queue::TimerEnqueueOperation; | ||
| 7 | |||
| 8 | /// Task is spawned (has a future) | 6 | /// Task is spawned (has a future) |
| 9 | pub(crate) const STATE_SPAWNED: u32 = 1 << 0; | 7 | pub(crate) const STATE_SPAWNED: u32 = 1 << 0; |
| 10 | /// Task is in the executor run queue | 8 | /// Task is in the executor run queue |
| 11 | pub(crate) const STATE_RUN_QUEUED: u32 = 1 << 1; | 9 | pub(crate) const STATE_RUN_QUEUED: u32 = 1 << 1; |
| 12 | /// Task is in the executor timer queue | ||
| 13 | pub(crate) const STATE_TIMER_QUEUED: u32 = 1 << 2; | ||
| 14 | 10 | ||
| 15 | pub(crate) struct State { | 11 | pub(crate) struct State { |
| 16 | state: Mutex<Cell<u32>>, | 12 | state: Mutex<Cell<u32>>, |
| @@ -81,25 +77,4 @@ impl State { | |||
| 81 | ok | 77 | ok |
| 82 | }) | 78 | }) |
| 83 | } | 79 | } |
| 84 | |||
| 85 | /// Mark the task as timer-queued. Return whether it can be enqueued. | ||
| 86 | #[inline(always)] | ||
| 87 | pub fn timer_enqueue(&self) -> TimerEnqueueOperation { | ||
| 88 | self.update(|s| { | ||
| 89 | // FIXME: we need to split SPAWNED into two phases, to prevent enqueueing a task that is | ||
| 90 | // just being spawned, because its executor pointer may still be changing. | ||
| 91 | if *s & STATE_SPAWNED == STATE_SPAWNED { | ||
| 92 | *s |= STATE_TIMER_QUEUED; | ||
| 93 | TimerEnqueueOperation::Enqueue | ||
| 94 | } else { | ||
| 95 | TimerEnqueueOperation::Ignore | ||
| 96 | } | ||
| 97 | }) | ||
| 98 | } | ||
| 99 | |||
| 100 | /// Unmark the task as timer-queued. | ||
| 101 | #[inline(always)] | ||
| 102 | pub fn timer_dequeue(&self) { | ||
| 103 | self.update(|s| *s &= !STATE_TIMER_QUEUED); | ||
| 104 | } | ||
| 105 | } | 80 | } |
