From 9da5e4a1fe226af688c08ea953a3526354c4a56f Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Wed, 14 Nov 2012 15:53:16 -0800 Subject: [PATCH] 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. --- model.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/model.cc b/model.cc index 35eefa67..daf2d15c 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; -- 2.34.1