From 8c63eac00ed32cd990a08413d1459e94e63921df Mon Sep 17 00:00:00 2001 From: Starnakin Date: Thu, 23 Jan 2025 14:48:53 +0100 Subject: [PATCH] fix: no switch to task when only one task --- src/multitasking/scheduler.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/multitasking/scheduler.c b/src/multitasking/scheduler.c index 674c5d9..39f6c44 100644 --- a/src/multitasking/scheduler.c +++ b/src/multitasking/scheduler.c @@ -3,14 +3,16 @@ #include "task.h" #include "time.h" -struct task *current_task; +#include + +struct task *current_task = NULL; void scheduler(void) { - if (!current_task) + if (!current_task || current_task->next == current_task) return; struct task *it = current_task->next; - while (it && it->next != it && it->status != RUN) + while (it && it->status != RUN) it = it->next; switch_to_task(it); }