diff options
| author | Dániel Buga <[email protected]> | 2024-12-17 18:05:48 +0100 |
|---|---|---|
| committer | Dániel Buga <[email protected]> | 2024-12-17 18:07:06 +0100 |
| commit | 8fd08b1e97533c7526bb4937770060d18bb37410 (patch) | |
| tree | 3e30a41e0d630f6b472bd85a4407f600ca07410a /embassy-executor/src/raw/run_queue_atomics.rs | |
| parent | edb8f21a741358f7c80b744f008f1e5acc77b429 (diff) | |
Swap poll_fn to allow polling exited tasks
Diffstat (limited to 'embassy-executor/src/raw/run_queue_atomics.rs')
| -rw-r--r-- | embassy-executor/src/raw/run_queue_atomics.rs | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/embassy-executor/src/raw/run_queue_atomics.rs b/embassy-executor/src/raw/run_queue_atomics.rs index aad90d767..ce511d79a 100644 --- a/embassy-executor/src/raw/run_queue_atomics.rs +++ b/embassy-executor/src/raw/run_queue_atomics.rs | |||
| @@ -81,16 +81,8 @@ impl RunQueue { | |||
| 81 | // safety: there are no concurrent accesses to `next` | 81 | // safety: there are no concurrent accesses to `next` |
| 82 | next = unsafe { task.header().run_queue_item.next.get() }; | 82 | next = unsafe { task.header().run_queue_item.next.get() }; |
| 83 | 83 | ||
| 84 | let run_task = task.header().state.run_dequeue(); | 84 | task.header().state.run_dequeue(); |
| 85 | 85 | on_task(task); | |
| 86 | if run_task { | ||
| 87 | // If task is not running, ignore it. This can happen in the following scenario: | ||
| 88 | // - Task gets dequeued, poll starts | ||
| 89 | // - While task is being polled, it gets woken. It gets placed in the queue. | ||
| 90 | // - Task poll finishes, returning done=true | ||
| 91 | // - RUNNING bit is cleared, but the task is already in the queue. | ||
| 92 | on_task(task); | ||
| 93 | } | ||
| 94 | } | 86 | } |
| 95 | } | 87 | } |
| 96 | } | 88 | } |
