diff options
| author | Dániel Buga <[email protected]> | 2024-12-17 18:51:22 +0100 |
|---|---|---|
| committer | Dániel Buga <[email protected]> | 2024-12-17 18:51:22 +0100 |
| commit | 76d8a896bbff612e3d2db27554891c71d28988af (patch) | |
| tree | 534911bb3fd3da96fb4ed1e598fdddbbd006a595 /embassy-executor/src/raw/mod.rs | |
| parent | 2ca374fc9c0d0abe579716d1a7c2dc0724321ee7 (diff) | |
Make poll_to_despawn a no_op
Diffstat (limited to 'embassy-executor/src/raw/mod.rs')
| -rw-r--r-- | embassy-executor/src/raw/mod.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/embassy-executor/src/raw/mod.rs b/embassy-executor/src/raw/mod.rs index 4a4ecf603..e38a2af66 100644 --- a/embassy-executor/src/raw/mod.rs +++ b/embassy-executor/src/raw/mod.rs | |||
| @@ -161,10 +161,8 @@ pub struct TaskStorage<F: Future + 'static> { | |||
| 161 | future: UninitCell<F>, // Valid if STATE_SPAWNED | 161 | future: UninitCell<F>, // Valid if STATE_SPAWNED |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | unsafe fn poll_to_despawn(p: TaskRef) { | 164 | unsafe fn poll_exited(_p: TaskRef) { |
| 165 | // The task's future has already been dropped, we just mark it as `!SPAWNED`. | 165 | // Nothing to do, the task is already !SPAWNED and dequeued. |
| 166 | let this = p.header(); | ||
| 167 | this.state.despawn(); | ||
| 168 | } | 166 | } |
| 169 | 167 | ||
| 170 | impl<F: Future + 'static> TaskStorage<F> { | 168 | impl<F: Future + 'static> TaskStorage<F> { |
| @@ -221,7 +219,7 @@ impl<F: Future + 'static> TaskStorage<F> { | |||
| 221 | 219 | ||
| 222 | // We replace the poll_fn with a despawn function, so that the task is cleaned up | 220 | // We replace the poll_fn with a despawn function, so that the task is cleaned up |
| 223 | // when the executor polls it next. | 221 | // when the executor polls it next. |
| 224 | this.raw.poll_fn.set(Some(poll_to_despawn)); | 222 | this.raw.poll_fn.set(Some(poll_exited)); |
| 225 | 223 | ||
| 226 | // Make sure we despawn last, so that other threads can only spawn the task | 224 | // Make sure we despawn last, so that other threads can only spawn the task |
| 227 | // after we're done with it. | 225 | // after we're done with it. |
