diff options
author | Christian Cunningham <cc@localhost> | 2022-01-21 15:08:19 -0700 |
---|---|---|
committer | Christian Cunningham <cc@localhost> | 2022-01-21 15:08:19 -0700 |
commit | c7c1702dc66f5be0f8f07703e2c8e9f5bd8db80d (patch) | |
tree | 47ad5aa7e90047d944ba134d4878077146c42973 | |
parent | dfde56396867428de6a81f01689a7a828dc91217 (diff) |
Simplified Queue Iteration Logic
-rw-r--r-- | src/sys/schedule.c | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/src/sys/schedule.c b/src/sys/schedule.c index e20abe7..119ad6b 100644 --- a/src/sys/schedule.c +++ b/src/sys/schedule.c @@ -23,30 +23,13 @@ void init_scheduler(void) for (int i = 0; i < PRIORITIES; i++) { tq = &scheduler.thread_queues[i]; struct ThreadRotBuffer* trb = &tq->ready; - trb->roffset = 0; - trb->woffset = 0; - for (int j = 0; j < TQUEUE_MAX; j++) - trb->queue[j] = 0; - trb = &tq->mwait; - trb->roffset = 0; - trb->woffset = 0; - for (int j = 0; j < TQUEUE_MAX; j++) - trb->queue[j] = 0; - trb = &tq->swait; - trb->roffset = 0; - trb->woffset = 0; - for (int j = 0; j < TQUEUE_MAX; j++) - trb->queue[j] = 0; - trb = &tq->finish; - trb->roffset = 0; - trb->woffset = 0; - for (int j = 0; j < TQUEUE_MAX; j++) - trb->queue[j] = 0; - trb = &tq->serror; - trb->roffset = 0; - trb->woffset = 0; - for (int j = 0; j < TQUEUE_MAX; j++) - trb->queue[j] = 0; + for (int i = 0; i < TQUEUE_CNT; i++) { + trb->roffset = 0; + trb->woffset = 0; + for (int j = 0; j < TQUEUE_MAX; j++) + trb->queue[j] = 0; + trb += 1; + } } // Initialize nextpid nextpid = SCHED_PID + 1; |