static void main_timer_interrupt(void) { static uint8_t cpt = 0; cpt++; sei(); if ((cpt & 0x3) == 0) scheduler_interrupt(); }
static void rr_loop(void *args){ RRThreadArgs *thread_args = args; int cpu = thread_args->cpu; ProcessControlBlock *proc; int quantum_ms = 1000; while(1){ sem_wait(&rr_cpu_available[cpu]); proc = rr_next(); assert( proc->state == READY ); scheduler_dispatch(proc, cpu); sleep_ms(quantum_ms); if(proc->state == RUNNING) scheduler_interrupt(proc); } }