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
|
future: UninitCell<F>, // Valid if STATE_SPAWNED
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn poll_to_despawn(p: TaskRef) {
|
unsafe fn poll_exited(_p: TaskRef) {
|
||||||
// The task's future has already been dropped, we just mark it as `!SPAWNED`.
|
// Nothing to do, the task is already !SPAWNED and dequeued.
|
||||||
let this = p.header();
|
|
||||||
this.state.despawn();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<F: Future + 'static> TaskStorage<F> {
|
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
|
// We replace the poll_fn with a despawn function, so that the task is cleaned up
|
||||||
// when the executor polls it next.
|
// 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
|
// Make sure we despawn last, so that other threads can only spawn the task
|
||||||
// after we're done with it.
|
// after we're done with it.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user