promise: rename check_promise() -> has_failed()
authorBrian Norris <banorris@uci.edu>
Wed, 23 Jan 2013 19:53:33 +0000 (11:53 -0800)
committerBrian Norris <banorris@uci.edu>
Wed, 23 Jan 2013 19:58:41 +0000 (11:58 -0800)
The name "check_promise" doesn't really tell what this function is
doing. It is actually checking if the promise is unresolvable.

model.cc
promise.cc
promise.h

index e46d36d76c3d3ede34cca70c32d562be3a327b0e..0964ae7ed2be03721cca662598200382151b2230 100644 (file)
--- 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;
                }
index c3aee517338d7225621cfbc581281552b99b92aa..7b110020cd869514c0f958055fea357f9f3c42ba 100644 (file)
@@ -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());
index 8a0ac590665e4454b22017ab516b5aad27c1f730..f30779c2131babfe0eb60038667f98cd5c73e2b2 100644 (file)
--- 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; }