mirror of
https://github.com/embassy-rs/embassy.git
synced 2025-09-27 12:20:37 +00:00
Make poll_to_despawn a no_op
This commit is contained in:
parent
2ca374fc9c
commit
76d8a896bb
@ -161,10 +161,8 @@ pub struct TaskStorage<F: Future + 'static> {
|
||||
future: UninitCell<F>, // Valid if STATE_SPAWNED
|
||||
}
|
||||
|
||||
unsafe fn poll_to_despawn(p: TaskRef) {
|
||||
// The task's future has already been dropped, we just mark it as `!SPAWNED`.
|
||||
let this = p.header();
|
||||
this.state.despawn();
|
||||
unsafe fn poll_exited(_p: TaskRef) {
|
||||
// Nothing to do, the task is already !SPAWNED and dequeued.
|
||||
}
|
||||
|
||||
impl<F: Future + 'static> TaskStorage<F> {
|
||||
@ -221,7 +219,7 @@ impl<F: Future + 'static> TaskStorage<F> {
|
||||
|
||||
// We replace the poll_fn with a despawn function, so that the task is cleaned up
|
||||
// when the executor polls it next.
|
||||
this.raw.poll_fn.set(Some(poll_to_despawn));
|
||||
this.raw.poll_fn.set(Some(poll_exited));
|
||||
|
||||
// Make sure we despawn last, so that other threads can only spawn the task
|
||||
// after we're done with it.
|
||||
|
Loading…
x
Reference in New Issue
Block a user