From ebefd4f80c4f50a4d90a002c5fbe9189c47647ae Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Sat, 12 Mar 2022 14:50:20 -0800 Subject: Better Testing --- src/sys/schedule.c | 1 + src/tests/test.c | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/sys/schedule.c b/src/sys/schedule.c index 287091c..9540d3d 100644 --- a/src/sys/schedule.c +++ b/src/sys/schedule.c @@ -202,6 +202,7 @@ void yield(void) // thus any threads of the same priority can be run first unsigned char priority = rthread->priority; struct ThreadQueue* trq = &scheduler.ready[priority]; + trq->read.entry->thread = 0; trq->read.entry = trq->read.entry->next; trq->write.entry->thread = rthread; trq->write.entry = trq->write.entry->next; diff --git a/src/tests/test.c b/src/tests/test.c index 7f18627..503e689 100644 --- a/src/tests/test.c +++ b/src/tests/test.c @@ -26,11 +26,13 @@ void test_entry(void) DRAW64(17, y+5, dt%64); // atest - add_thread(atest, 0, 0); - sys0_64(SYS_TIME, &ti); - sys0(SYS_YIELD); - sys0_64(SYS_TIME, &tf); - dt = tf - ti; + //add_thread(atest, 0, 0); + for(int i = 0; i < 64; i++) { + sys0_64(SYS_TIME, &ti); + sys0(SYS_YIELD); + sys0_64(SYS_TIME, &tf); + dt += tf - ti; + } DRAW64(34, y+5, dt/64); DRAW64(34+17, y+5, dt%64); add_thread(btest, 0, 4); -- cgit v1.2.1