From: Brian Norris Date: Wed, 23 Jan 2013 19:53:33 +0000 (-0800) Subject: promise: rename check_promise() -> has_failed() X-Git-Tag: oopsla2013~338 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=model-checker.git;a=commitdiff_plain;h=ccb7650d28bc49534bfb75de43447900cd048461 promise: rename check_promise() -> has_failed() The name "check_promise" doesn't really tell what this function is doing. It is actually checking if the promise is unresolvable. --- diff --git a/model.cc b/model.cc index e46d36d..0964ae7 100644 --- a/model.cc +++ b/model.cc @@ -2388,10 +2388,11 @@ void ModelChecker::check_promises(thread_id_t tid, ClockVector *old_cv, ClockVec } } -void ModelChecker::check_promises_thread_disabled() { +void ModelChecker::check_promises_thread_disabled() +{ for (unsigned int i = 0; i < promises->size(); i++) { Promise *promise = (*promises)[i]; - if (promise->check_promise()) { + if (promise->has_failed()) { priv->failed_promise = true; return; } diff --git a/promise.cc b/promise.cc index c3aee51..7b11002 100644 --- a/promise.cc +++ b/promise.cc @@ -19,10 +19,16 @@ bool Promise::eliminate_thread(thread_id_t tid) return false; synced_thread[id] = true; - return check_promise(); + return has_failed(); } -bool Promise::check_promise() const +/** + * Check if this promise has failed. A promise can fail when all threads which + * could possibly satisfy the promise have been eliminated. + * + * @return True, if this promise has failed; false otherwise + */ +bool Promise::has_failed() const { unsigned int sync_size = synced_thread.size(); int promise_tid = id_to_int(read->get_tid()); diff --git a/promise.h b/promise.h index 8a0ac59..f30779c 100644 --- a/promise.h +++ b/promise.h @@ -39,7 +39,7 @@ class Promise { return synced_thread[id]; } - bool check_promise() const; + bool has_failed() const; uint64_t get_value() const { return value; } void set_write(const ModelAction *act) { write = act; } const ModelAction * get_write() { return write; }