wip: multitasking: add status forked

This commit is contained in:
2025-02-03 13:11:38 +01:00
parent 18486a6705
commit 7b7cc86999
5 changed files with 49 additions and 21 deletions

View File

@ -11,14 +11,18 @@ struct task *current_task;
void scheduler(void)
{
// ZOMBIE, THREAD, RUN, WAIT, SLEEP, STOPPED, FORKED
void (*func[])(struct task *) = {remove_task, NULL, NULL, NULL,
NULL, remove_task, kfork};
if (!current_task) // || current_task->next == current_task)
return;
cli();
struct task *it = current_task->next;
while (it && it->status != RUN) {
if (it->status == STOPPED || it->status == ZOMBIE) {
if (it != current_task && func[it->status]) {
struct task *new_it = it->prev;
remove_task(it);
func[it->status](it);
it = new_it;
}
it = it->next;