diff --git a/src/scheduler/task.rs b/src/scheduler/task.rs index a0320e7b70..b2f8f58e8e 100644 --- a/src/scheduler/task.rs +++ b/src/scheduler/task.rs @@ -463,31 +463,26 @@ impl BlockedTaskQueue { } fn wakeup_task(task: Rc>) { - { - let mut borrowed = task.borrow_mut(); - debug!( - "Waking up task {} on core {}", - borrowed.id, borrowed.core_id - ); - - assert!( - borrowed.core_id == core_id(), - "Try to wake up task {} on the wrong core {} != {}", - borrowed.id, - borrowed.core_id, - core_id() - ); + let mut borrowed = task.borrow_mut(); + debug!( + "Waking up task {} on core {}", + borrowed.id, borrowed.core_id + ); - assert!( - borrowed.status == TaskStatus::Blocked, - "Trying to wake up task {} which is not blocked", - borrowed.id - ); - borrowed.status = TaskStatus::Ready; - } + assert!( + borrowed.core_id == core_id(), + "Try to wake up task {} on the wrong core {} != {}", + borrowed.id, + borrowed.core_id, + core_id() + ); - // Add the task to the ready queue. - core_scheduler().ready_queue.push(task); + assert!( + borrowed.status == TaskStatus::Blocked, + "Trying to wake up task {} which is not blocked", + borrowed.id + ); + borrowed.status = TaskStatus::Ready; } #[cfg(any(feature = "tcp", feature = "udp"))] @@ -624,7 +619,10 @@ impl BlockedTaskQueue { } // Wake it up. - Self::wakeup_task(task_ref); + Self::wakeup_task(task_ref.clone()); + + // Add the task to the ready queue. + core_scheduler().ready_queue.push(task_ref); return; } @@ -696,7 +694,10 @@ impl BlockedTaskQueue { ); for task in tasks { - Self::wakeup_task(task); + Self::wakeup_task(task.clone()); + + // Add the task to the ready queue. + core_scheduler().ready_queue.push(task); } } }