X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;ds=sidebyside;f=model.cc;h=83c79c97ffc654818df100c04ebbf5efa8c244a6;hb=dcf7f575967bec560d500cc4f52e35c21671525c;hp=b73d31a579051c94cb909cac5d7e8330cde00ee0;hpb=ff05fa2d8214200766cf442b47e3a7e1356341f8;p=model-checker.git diff --git a/model.cc b/model.cc index b73d31a..83c79c9 100644 --- a/model.cc +++ b/model.cc @@ -286,8 +286,7 @@ void ModelChecker::execute_sleep_set() { for(unsigned int i=0;iget_enabled(thr) == THREAD_SLEEP_SET && - thr->get_pending() == NULL ) { + if (scheduler->is_sleep_set(thr) && thr->get_pending() == NULL) { thr->set_state(THREAD_RUNNING); scheduler->next_thread(thr); Thread::swap(&system_context, thr); @@ -298,16 +297,15 @@ void ModelChecker::execute_sleep_set() { priv->current_action = NULL; } -void ModelChecker::wake_up_sleeping_actions(ModelAction * curr) { - for(unsigned int i=0;iget_enabled(thr) == THREAD_SLEEP_SET ) { - ModelAction *pending_act=thr->get_pending(); - if ((!curr->is_rmwr())&&pending_act->could_synchronize_with(curr)) { +void ModelChecker::wake_up_sleeping_actions(ModelAction *curr) +{ + for (unsigned int i = 0; i < get_num_threads(); i++) { + Thread *thr = get_thread(int_to_id(i)); + if (scheduler->is_sleep_set(thr)) { + ModelAction *pending_act = thr->get_pending(); + if ((!curr->is_rmwr()) && pending_act->could_synchronize_with(curr)) //Remove this thread from sleep set scheduler->remove_sleep(thr); - } } } } @@ -1517,18 +1515,21 @@ bool ModelChecker::r_modification_order(ModelAction *curr, const ModelAction *rf *act < *last_sc_fence_thread_local) { mo_graph->addEdge(act, rf); added = true; + break; } /* C++, Section 29.3 statement 4 */ else if (act->is_seqcst() && last_sc_fence_local && *act < *last_sc_fence_local) { mo_graph->addEdge(act, rf); added = true; + break; } /* C++, Section 29.3 statement 6 */ else if (last_sc_fence_thread_before && *act < *last_sc_fence_thread_before) { mo_graph->addEdge(act, rf); added = true; + break; } } @@ -1705,6 +1706,7 @@ bool ModelChecker::w_modification_order(ModelAction *curr) *act < *last_sc_fence_thread_before) { mo_graph->addEdge(act, curr); added = true; + break; } /*