X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=execution.cc;h=d455b5161e988fa3fe9ef00da1402a9782b6409b;hb=cae88a8c7de282bc4c76fa5c75e5f37107bcd5d0;hp=97e58511e0307c3d4d2fe06177178e53718f5675;hpb=3e2ec3ed4b37f4e6aa8e5e0e9e3241890948c3ac;p=c11tester.git diff --git a/execution.cc b/execution.cc index 97e58511..d455b516 100644 --- a/execution.cc +++ b/execution.cc @@ -376,6 +376,8 @@ bool ModelExecution::process_mutex(ModelAction *curr) //TODO: FIND SOME BETTER WAY TO CHECK LOCK INITIALIZED OR NOT //if (curr->get_cv()->getClock(state->alloc_tid) <= state->alloc_clock) // assert_bug("Lock access before initialization"); + + // TODO: lock count for recursive mutexes state->locked = get_thread(curr); ModelAction *unlock = get_last_unlock(curr); //synchronize with the previous unlock statement @@ -417,6 +419,7 @@ bool ModelExecution::process_mutex(ModelAction *curr) //FAILS AND IN THE CASE IT DOESN'T... TIMED WAITS //MUST EVENMTUALLY RELEASE... + // TODO: lock count for recursive mutexes /* wake up the other threads */ for (unsigned int i = 0;i < get_num_threads();i++) { Thread *t = get_thread(int_to_id(i)); @@ -691,8 +694,15 @@ bool ModelExecution::check_action_enabled(ModelAction *curr) { if (curr->is_lock()) { cdsc::mutex *lock = curr->get_mutex(); struct cdsc::mutex_state *state = lock->get_state(); - if (state->locked) + if (state->locked) { + Thread *lock_owner = (Thread *)state->locked; + Thread *curr_thread = get_thread(curr); + if (lock_owner == curr_thread && state->type == PTHREAD_MUTEX_RECURSIVE) { + return true; + } + return false; + } } else if (curr->is_thread_join()) { Thread *blocking = curr->get_thread_operand(); if (!blocking->is_complete()) {