From: weiyu Date: Mon, 6 Apr 2020 19:49:48 +0000 (-0700) Subject: Fix waiter list X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=commitdiff_plain;h=8b57ab066a2b74a81c4261482ba9030465eb0dbe Fix waiter list --- diff --git a/execution.cc b/execution.cc index d455b516..48c73cfb 100644 --- a/execution.cc +++ b/execution.cc @@ -401,8 +401,17 @@ bool ModelExecution::process_mutex(ModelAction *curr) /* unlock the lock - after checking who was waiting on it */ state->locked = NULL; - /* disable this thread */ - get_safe_ptr_action(&condvar_waiters_map, curr->get_location())->push_back(curr); + /* remove old wait action and disable this thread */ + action_list_t * waiters = get_safe_ptr_action(&condvar_waiters_map, curr->get_location()); + for (sllnode * it = waiters->begin(); it != NULL; it = it->getNext()) { + ModelAction * wait = it->getVal(); + if (wait->get_tid() == curr->get_tid()) { + waiters->erase(it); + break; + } + } + + waiters->push_back(curr); scheduler->sleep(get_thread(curr)); }