From 56e9363b0ef5826be10312a5e2ce664e6939e7ac Mon Sep 17 00:00:00 2001 From: weiyu Date: Tue, 28 May 2019 16:50:58 -0700 Subject: [PATCH] fix the case where no waiter is waiting --- execution.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; -- 2.34.1