X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=model.cc;h=cffaea874740ada79a5ee89e0901e31e9dbcdb2c;hb=1bdb456ee7767a75d266716459a85743740acc33;hp=4c4b47ac4c12e466bbe4d03b687a9a3f5debf113;hpb=656b0a3c7d65500c7eba70dbcb6c5b54c358f370;p=c11tester.git diff --git a/model.cc b/model.cc index 4c4b47ac..cffaea87 100644 --- a/model.cc +++ b/model.cc @@ -413,7 +413,7 @@ void ModelChecker::run() for (unsigned int i = 0;i < get_num_threads();i++) { thread_id_t tid = int_to_id(i); Thread *thr = get_thread(tid); - if (!thr->is_model_thread() && !thr->is_complete() && (!thr->get_pending())) { + if (!thr->is_model_thread() && !thr->is_complete() && !thr->get_pending()) { switch_from_master(thr); if (thr->is_waiting_on(thr)) assert_bug("Deadlock detected (thread %u)", i); @@ -459,6 +459,12 @@ void ModelChecker::run() t = get_next_thread(); if (!t || t->is_model_thread()) break; + if (t->just_woken_up()) { + t->set_wakeup_state(false); + t->set_pending(NULL); + t = NULL; + continue; // Allow this thread to stash the next pending action + } /* Consume the next action for a Thread */ ModelAction *curr = t->get_pending();