fix: no switch to task when only one task

This commit is contained in:
Starnakin 2025-01-23 14:48:53 +01:00
parent d4db6acf61
commit 8c63eac00e

View File

@ -3,14 +3,16 @@
#include "task.h" #include "task.h"
#include "time.h" #include "time.h"
struct task *current_task; #include <stddef.h>
struct task *current_task = NULL;
void scheduler(void) void scheduler(void)
{ {
if (!current_task) if (!current_task || current_task->next == current_task)
return; return;
struct task *it = current_task->next; struct task *it = current_task->next;
while (it && it->next != it && it->status != RUN) while (it && it->status != RUN)
it = it->next; it = it->next;
switch_to_task(it); switch_to_task(it);
} }