model: privatize ModelChecker::get_num_threads()
authorBrian Norris <banorris@uci.edu>
Tue, 16 Apr 2013 18:58:28 +0000 (11:58 -0700)
committerBrian Norris <banorris@uci.edu>
Tue, 16 Apr 2013 18:58:28 +0000 (11:58 -0700)
The public interface is now in ModelExecution.

model.cc
model.h
nodestack.cc

index 8e94561531ca063ccbd23bec2bf51d778530a95d..0d79a39c623158858a8cc5efa29b16322191150e 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -444,7 +444,7 @@ void ModelChecker::run()
                         * thread which just took a step--plus the first step
                         * for any newly-created thread
                         */
-                       for (unsigned int i = 0; i < execution->get_num_threads(); i++) {
+                       for (unsigned int i = 0; i < get_num_threads(); i++) {
                                thread_id_t tid = int_to_id(i);
                                Thread *thr = get_thread(tid);
                                if (!thr->is_model_thread() && !thr->is_complete() && !thr->get_pending()) {
diff --git a/model.h b/model.h
index 92592e5a8a191c2cc9421e944c32a2cc47c0eda1..77db6aa79569c9611d1e296fa5fa2b4134f6e584 100644 (file)
--- a/model.h
+++ b/model.h
@@ -60,7 +60,6 @@ public:
        bool is_enabled(Thread *t) const;
        bool is_enabled(thread_id_t tid) const;
 
-       unsigned int get_num_threads() const;
        Thread * get_current_thread() const;
 
        void switch_from_master(Thread *thread);
@@ -83,6 +82,8 @@ private:
 
        int execution_number;
 
+       unsigned int get_num_threads() const;
+
        void execute_sleep_set();
 
        bool next_execution();
index bfcf11ff6dafb0f525b92b202e5401b5f3ce046f..80bf5c41bf1d1721e20ad7d6d38fe7f141ed869f 100644 (file)
@@ -803,7 +803,7 @@ ModelAction * NodeStack::explore_action(ModelAction *act, enabled_type_t *is_ena
                        prevfairness = node_list[head_idx - model->params.fairwindow];
        }
 
-       int next_threads = model->get_num_threads();
+       int next_threads = execution->get_num_threads();
        if (act->get_type() == THREAD_CREATE)
                next_threads++;
        node_list.push_back(new Node(act, head, next_threads, prevfairness));