X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=schedule.cc;h=4d1cb126579584942c67e32160c8f5e33669472b;hb=b2e1861247c00af280dafdfd79e855f0011dee2d;hp=2498347c44cc6e2cb6cbb870a829465c318504db;hpb=5e2338d51de26e3ea875587f62b095c5d0111ae2;p=model-checker.git diff --git a/schedule.cc b/schedule.cc index 2498347..4d1cb12 100644 --- a/schedule.cc +++ b/schedule.cc @@ -13,19 +13,19 @@ Thread *Scheduler::next_thread(void) { Thread *t = model->schedule_next_thread(); - print(); - if (t != NULL) { readyList.remove(t); - return t; + } else if (readyList.empty()) { + t = NULL; + } else { + t = readyList.front(); + current = t; + readyList.pop_front(); } - if (readyList.empty()) - return NULL; - current = readyList.front(); - readyList.pop_front(); + print(); - return current; + return t; } Thread *Scheduler::get_current_thread(void)