model: routine to check if execution is complete
authorBrian Norris <banorris@uci.edu>
Thu, 15 Nov 2012 00:46:03 +0000 (16:46 -0800)
committerBrian Norris <banorris@uci.edu>
Thu, 15 Nov 2012 19:33:39 +0000 (11:33 -0800)
Not used yet.

model.cc
model.h

index e5c8a55033289bf7393094c514d9e85658489342..33fc4c3c38c3b5affc65bf360a833f5de8f8175e 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -294,6 +294,21 @@ bool ModelChecker::is_deadlocked() const
        return blocking_threads;
 }
 
+/**
+ * Check if this is a complete execution. That is, have all thread completed
+ * execution (rather than exiting because sleep sets have forced a redundant
+ * execution).
+ *
+ * @return True if the execution is complete.
+ */
+bool ModelChecker::is_complete_execution() const
+{
+       for (unsigned int i = 0; i < get_num_threads(); i++)
+               if (is_enabled(int_to_id(i)))
+                       return false;
+       return true;
+}
+
 /**
  * Queries the model-checker for more executions to explore and, if one
  * exists, resets the model-checker state to execute a new execution.
diff --git a/model.h b/model.h
index 85101fee11931f581c1d8812737b0532d20b693b..ee8026d03c90ca62c0b8a865d491fc891c289e37 100644 (file)
--- a/model.h
+++ b/model.h
@@ -109,6 +109,7 @@ public:
        bool isfeasibleprefix();
        void set_assert() {asserted=true;}
        bool is_deadlocked() const;
+       bool is_complete_execution() const;
 
        /** @brief Alert the model-checker that an incorrectly-ordered
         * synchronization was made */