From: Brian Norris Date: Wed, 14 Nov 2012 23:52:16 +0000 (-0800) Subject: model: add ModelChecker is_enabled() functions X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=commitdiff_plain;h=c85c272294e7208e13ee5fb8e7481ee6a3732911 model: add ModelChecker is_enabled() functions We don't want all users to have to directly address the scheduler; provide an interface. --- diff --git a/model.cc b/model.cc index bfdae30d..35eefa67 100644 --- 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 081a8ce6..b8832ef0 100644 --- 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();