Skip to content

Commit 167bdff

Browse files
committed
std::rt: Schedule more scheduler callbacks to avoid dropping messages
1 parent d123df2 commit 167bdff

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/libstd/rt/sched.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,8 @@ impl Scheduler {
339339
let mut this = self;
340340
match this.message_queue.pop() {
341341
Some(PinnedTask(task)) => {
342-
let mut task = task;
343342
this.event_loop.callback(Scheduler::run_sched_once);
343+
let mut task = task;
344344
task.give_home(Sched(this.make_handle()));
345345
this.resume_task_immediately(task);
346346
return None;
@@ -351,10 +351,12 @@ impl Scheduler {
351351
return this.sched_schedule_task(task);
352352
}
353353
Some(Wake) => {
354+
this.event_loop.callback(Scheduler::run_sched_once);
354355
this.sleepy = false;
355356
return Some(this);
356357
}
357358
Some(Shutdown) => {
359+
this.event_loop.callback(Scheduler::run_sched_once);
358360
if this.sleepy {
359361
// There may be an outstanding handle on the
360362
// sleeper list. Pop them all to make sure that's

0 commit comments

Comments
 (0)