From b7fa004403a49e09e9b92c8ede8ecec3b41c7735 Mon Sep 17 00:00:00 2001 From: mrgian Date: Fri, 30 Jun 2023 17:52:03 +0200 Subject: [PATCH] Don't remove idle task --- kernel/src/multitasking/task.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/src/multitasking/task.rs b/kernel/src/multitasking/task.rs index 237455c..60ee425 100644 --- a/kernel/src/multitasking/task.rs +++ b/kernel/src/multitasking/task.rs @@ -127,8 +127,10 @@ impl TaskManager { //remove task pub fn remove_task(&mut self, id: usize) { - self.tasks[id] = 0 as *mut Task; - self.task_count -= 1; + if id != 0 { + self.tasks[id] = 0 as *mut Task; + self.task_count -= 1; + } } pub fn remove_current_task(&mut self) {