Don't notify task if ready

This commit is contained in:
kidkool850@gmail.com committed 2023-12-15 22:23:59 -06:00
1 parent 493b0693c5
commit ed2ce6e039
1 file changed
+4 -3
+4 -3
View File
@@ -49,13 +49,14 @@ impl Scheduler {
}; };
let mut cx = std::task::Context::from_waker(&task.waker); let mut cx = std::task::Context::from_waker(&task.waker);
let _ = task.task.borrow_mut().as_mut().poll(&mut cx);
entry.insert(task);
if !task.task.borrow_mut().as_mut().poll(&mut cx).is_ready() {
self.sender self.sender
.unbounded_send(SchedulerMsg::TaskNotified(task_id)) .unbounded_send(SchedulerMsg::TaskNotified(task_id))
.expect("Scheduler should exist"); .expect("Scheduler should exist");
}
entry.insert(task);
task_id task_id
} }