From 00bfb38e139e7ee131c137ae27f5e82ee642a9d8 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Wed, 23 Jan 2013 12:50:57 -0800 Subject: [PATCH] promise: refactor has_failed() has_failed() can simply call the thread_is_eliminated() function which does much of the same computation already. We can drop the '((int)i != promise_tid)' clause, since the 'promise_tid' thread must already be eliminated. --- promise.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/promise.cc b/promise.cc index 7f6f5e7..016b809 100644 --- a/promise.cc +++ b/promise.cc @@ -44,12 +44,10 @@ bool Promise::thread_is_eliminated(thread_id_t tid) const */ bool Promise::has_failed() const { - unsigned int size = eliminated_thread.size(); - int promise_tid = id_to_int(read->get_tid()); for (unsigned int i = 1; i < model->get_num_threads(); i++) { - if ((i >= size || !eliminated_thread[i]) && ((int)i != promise_tid) && model->is_enabled(int_to_id(i))) { + thread_id_t tid = int_to_id(i); + if (!thread_is_eliminated(tid) && model->is_enabled(tid)) return false; - } } return true; } -- 2.34.1