promise: rename increment_threads() -> eliminate_thread()
authorBrian Norris <banorris@uci.edu>
Wed, 23 Jan 2013 19:38:43 +0000 (11:38 -0800)
committerBrian Norris <banorris@uci.edu>
Wed, 23 Jan 2013 19:41:50 +0000 (11:41 -0800)
This function name really doesn't describe what it does, in my opinion.
Update the name and add a description.

cyclegraph.cc
model.cc
promise.cc
promise.h

index 8326f28b7ee3a2c3be6332fc383f959707040eac..9a511952b0826470befc1a2bcc7ecde85619265c 100644 (file)
@@ -219,7 +219,7 @@ bool CycleGraph::checkPromise(const ModelAction *fromact, Promise *promise) cons
                CycleNode *node = queue.back();
                queue.pop_back();
 
-               if (promise->increment_threads(node->getAction()->get_tid())) {
+               if (promise->eliminate_thread(node->getAction()->get_tid())) {
                        return true;
                }
 
index 39c19685b119225df02e0666f61775b775351c6f..e46d36d76c3d3ede34cca70c32d562be3a327b0e 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -2379,7 +2379,7 @@ void ModelChecker::check_promises(thread_id_t tid, ClockVector *old_cv, ClockVec
                const ModelAction *act = promise->get_action();
                if ((old_cv == NULL || !old_cv->synchronized_since(act)) &&
                                merge_cv->synchronized_since(act)) {
-                       if (promise->increment_threads(tid)) {
+                       if (promise->eliminate_thread(tid)) {
                                //Promise has failed
                                priv->failed_promise = true;
                                return;
@@ -2462,7 +2462,7 @@ void ModelChecker::mo_check_promises(thread_id_t tid, const ModelAction *write,
                        continue;
 
                if (promise->get_write() && mo_graph->checkReachable(promise->get_write(), write)) {
-                       if (promise->increment_threads(tid)) {
+                       if (promise->eliminate_thread(tid)) {
                                priv->failed_promise = true;
                                return;
                        }
index 62e2c9d24d67dbd2509faba6736bec62ea410f84..943a0f4f9ba09f1d7a7c67521b1c570ca6db0bf2 100644 (file)
@@ -2,7 +2,15 @@
 #include "model.h"
 #include "schedule.h"
 
-bool Promise::increment_threads(thread_id_t tid)
+/**
+ * Eliminate a thread which no longer can satisfy this promise. Once all
+ * enabled threads have been eliminated, this promise is unresolvable.
+ *
+ * @param tid The thread ID of the thread to eliminate
+ * @return True, if this elimination has invalidated the promise; false
+ * otherwise
+ */
+bool Promise::eliminate_thread(thread_id_t tid)
 {
        unsigned int id = id_to_int(tid);
        if (id >= synced_thread.size())
index ce5bea168f60cfacc4ee01efaad343a1db2c9039..8a0ac590665e4454b22017ab516b5aad27c1f730 100644 (file)
--- a/promise.h
+++ b/promise.h
@@ -26,11 +26,11 @@ class Promise {
                read(act),
                write(NULL)
        {
-               increment_threads(act->get_tid());
+               eliminate_thread(act->get_tid());
        }
        modelclock_t get_expiration() const { return expiration; }
        ModelAction * get_action() const { return read; }
-       bool increment_threads(thread_id_t tid);
+       bool eliminate_thread(thread_id_t tid);
 
        bool has_sync_thread(thread_id_t tid) {
                unsigned int id = id_to_int(tid);