diff --git a/embassy-executor/src/raw/mod.rs b/embassy-executor/src/raw/mod.rs index 39d2d73ab3..ddeb3409b4 100644 --- a/embassy-executor/src/raw/mod.rs +++ b/embassy-executor/src/raw/mod.rs @@ -215,7 +215,7 @@ impl TaskStorage { let mut cx = Context::from_waker(&waker); match future.poll(&mut cx) { Poll::Ready(_) => { - waker.wake_by_ref(); + this.raw.state.despawn(); // As the future has finished and this function will not be called // again, we can safely drop the future here. diff --git a/embassy-executor/tests/test.rs b/embassy-executor/tests/test.rs index d8c5a6ae39..78c49c0719 100644 --- a/embassy-executor/tests/test.rs +++ b/embassy-executor/tests/test.rs @@ -69,7 +69,6 @@ fn executor_task() { &[ "pend", // spawning a task pends the executor "poll task1", // poll only once. - "pend", // task is done, wakes itself to exit ] ) } @@ -180,7 +179,6 @@ fn waking_after_completion_does_not_poll() { "pend", // manual wake, single pend for two wakes "pend", // respawning a task pends the executor "poll task1", // - "pend", // task is done, wakes itself to exit ] ) } @@ -268,7 +266,6 @@ fn waking_with_old_waker_after_respawn() { "yield_now", // "pend", // manual wake, gets cleared by poll "poll task1", // - "pend", // task is done, wakes itself to exit ] ); }