model: add ModelChecker is_enabled() functions
authorBrian Norris <banorris@uci.edu>
Wed, 14 Nov 2012 23:52:16 +0000 (15:52 -0800)
committerBrian Norris <banorris@uci.edu>
Wed, 14 Nov 2012 23:52:16 +0000 (15:52 -0800)
We don't want all users to have to directly address the scheduler;
provide an interface.

model.cc
model.h

index bfdae30d407dc0b8a41b7815427b3380c7b65ffc..35eefa674d43d937799acd8940e00d1b0faf4cc3 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -2198,6 +2198,26 @@ Thread * ModelChecker::get_thread(ModelAction *act) const
        return get_thread(act->get_tid());
 }
 
+/**
+ * @brief Check if a Thread is currently enabled
+ * @param t The Thread to check
+ * @return True if the Thread is currently enabled
+ */
+bool ModelChecker::is_enabled(Thread *t) const
+{
+       return scheduler->is_enabled(t);
+}
+
+/**
+ * @brief Check if a Thread is currently enabled
+ * @param tid The ID of the Thread to check
+ * @return True if the Thread is currently enabled
+ */
+bool ModelChecker::is_enabled(thread_id_t tid) const
+{
+       return scheduler->is_enabled(tid);
+}
+
 /**
  * Switch from a user-context to the "master thread" context (a.k.a. system
  * context). This switch is made with the intention of exploring a particular
diff --git a/model.h b/model.h
index 081a8ce603bcba39728c2a30bf59ddb9c3261649..b8832ef0344891ae36ba8abe3a7fd1b5fda89510 100644 (file)
--- a/model.h
+++ b/model.h
@@ -87,6 +87,9 @@ public:
        Thread * get_thread(thread_id_t tid) const;
        Thread * get_thread(ModelAction *act) const;
 
+       bool is_enabled(Thread *t) const;
+       bool is_enabled(thread_id_t tid) const;
+
        thread_id_t get_next_id();
        unsigned int get_num_threads() const;
        Thread * get_current_thread();