From: Brian Norris Date: Wed, 14 Nov 2012 23:53:16 +0000 (-0800) Subject: model: is_deadlocked() (sort of) had a bug X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=9da5e4a1fe226af688c08ea953a3526354c4a56f;p=cdsspec-compiler.git model: is_deadlocked() (sort of) had a bug We were comparing the boolean (is_enabled(t)) to an enum (THREAD_DISABLED). This happened to work as we wanted to because THREAD_DISABLED == 0 == false. But that's not really what I meant... Anyway, this uses a proper ModelChecker::is_enabled(tid) interface. --- diff --git a/model.cc b/model.cc index 35eefa6..daf2d15 100644 --- a/model.cc +++ b/model.cc @@ -266,10 +266,11 @@ bool ModelChecker::is_deadlocked() const { bool blocking_threads = false; for (unsigned int i = 0; i < get_num_threads(); i++) { - Thread *t = get_thread(int_to_id(i)); - if (scheduler->is_enabled(t) != THREAD_DISABLED) + thread_id_t tid = int_to_id(i); + if (is_enabled(tid)) return false; - else if (!t->is_model_thread() && t->get_pending()) + Thread *t = get_thread(tid); + if (!t->is_model_thread() && t->get_pending()) blocking_threads = true; } return blocking_threads;