From 8cebf02d9a4c9f0fe80af04f6276f4978f3b93f5 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Wed, 23 Jan 2013 11:38:43 -0800 Subject: [PATCH] promise: rename increment_threads() -> eliminate_thread() This function name really doesn't describe what it does, in my opinion. Update the name and add a description. --- cyclegraph.cc | 2 +- model.cc | 4 ++-- promise.cc | 10 +++++++++- promise.h | 4 ++-- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/cyclegraph.cc b/cyclegraph.cc index 8326f28..9a51195 100644 --- a/cyclegraph.cc +++ b/cyclegraph.cc @@ -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; } diff --git a/model.cc b/model.cc index 39c1968..e46d36d 100644 --- 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; } diff --git a/promise.cc b/promise.cc index 62e2c9d..943a0f4 100644 --- a/promise.cc +++ b/promise.cc @@ -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()) diff --git a/promise.h b/promise.h index ce5bea1..8a0ac59 100644 --- 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); -- 2.34.1