Restart executor on finish if there are retries

This commit is contained in:
Emil Fresk 2022-06-12 21:24:26 +02:00
parent b2ec1fa651
commit 952bb5c431
2 changed files with 20 additions and 11 deletions

View file

@ -65,7 +65,7 @@ pub mod executor {
self.task = Some(future);
}
pub fn poll(&mut self, wake: fn()) {
pub fn poll(&mut self, wake: fn()) -> bool {
if let Some(future) = &mut self.task {
unsafe {
let waker = Waker::from_raw(RawWaker::new(wake as *const (), &WAKER_VTABLE));
@ -75,10 +75,13 @@ pub mod executor {
match future.poll(&mut cx) {
Poll::Ready(_) => {
self.task = None;
true // Only true if we finished now
}
Poll::Pending => {}
};
Poll::Pending => false,
}
}
} else {
false
}
}
}