Skip to content

Commit

Permalink
baz
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Kröning <[email protected]>
  • Loading branch information
mkroening committed Sep 14, 2023
1 parent 599e094 commit cbd811c
Showing 1 changed file with 26 additions and 25 deletions.
51 changes: 26 additions & 25 deletions src/scheduler/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,31 +463,26 @@ impl BlockedTaskQueue {
}

fn wakeup_task(task: Rc<RefCell<Task>>) {
{
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"))]
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
}
}
}

0 comments on commit cbd811c

Please sign in to comment.