From: weiyu Date: Tue, 28 May 2019 23:50:58 +0000 (-0700) Subject: fix the case where no waiter is waiting X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=56e9363b0ef5826be10312a5e2ce664e6939e7ac;p=c11tester.git fix the case where no waiter is waiting --- diff --git a/execution.cc b/execution.cc index f6b59cd9..8fdc9fbe 100644 --- a/execution.cc +++ b/execution.cc @@ -753,6 +753,11 @@ bool ModelExecution::process_mutex(ModelAction *curr) action_list_t *waiters = get_safe_ptr_action(&condvar_waiters_map, curr->get_location()); int wakeupthread = curr->get_node()->get_misc(); action_list_t::iterator it = waiters->begin(); + + // WL + if (it == waiters->end()) + break; + advance(it, wakeupthread); scheduler->wake(get_thread(*it)); waiters->erase(it); @@ -2727,7 +2732,7 @@ static void print_list(const action_list_t *list) action_list_t::const_iterator it; model_print("------------------------------------------------------------------------------------\n"); - model_print("# t Action type MO Location Value Rf CV\n"); + model_print("# t Action type MO Location Value Rf CV\n"); model_print("------------------------------------------------------------------------------------\n"); unsigned int hash = 0;