#include "alloc.h" #include "debug.h" #include "interrupts.h" #include "kprintf.h" #include "process.h" #include "thread.h" #include "time.h" #include struct pcb *current_pcb; struct tcb *current_tcb; void scheduler(void) { struct tcb *thread_to_switch; if (!current_tcb) { thread_to_switch = current_pcb->thread_list; } else { if (!current_tcb->next) { current_pcb = current_pcb->next; // TODO switch context thread_to_switch = current_pcb->thread_list; } else { thread_to_switch = current_tcb->next; } } switch_thread(thread_to_switch); }