schedule: drop the ModelChecker::check_promises_thread_disabled interface
authorBrian Norris <banorris@uci.edu>
Tue, 16 Apr 2013 02:37:21 +0000 (19:37 -0700)
committerBrian Norris <banorris@uci.edu>
Tue, 16 Apr 2013 02:37:21 +0000 (19:37 -0700)
execution.cc
model.h
schedule.cc
schedule.h

index fe9175b2fb336965e3aa23f867432fabee1441d3..828502686d0194e642e8b2335c910c33f86ff049 100644 (file)
@@ -82,6 +82,7 @@ ModelExecution::ModelExecution(struct model_params *params, Scheduler *scheduler
        /* Initialize a model-checker thread, for special ModelActions */
        model_thread = new Thread(get_next_id());
        thread_map->put(id_to_int(model_thread->get_id()), model_thread);
+       scheduler->register_engine(this);
 }
 
 /** @brief Destructor */
diff --git a/model.h b/model.h
index be53ec3fb4ea57858fd55fae54f3b65672b33607..cfc652866da765899fa3e6f452b3403fa6bcc03b 100644 (file)
--- a/model.h
+++ b/model.h
@@ -63,7 +63,6 @@ public:
 
        void switch_from_master(Thread *thread);
        uint64_t switch_to_master(ModelAction *act);
-       void check_promises_thread_disabled();
 
        bool assert_bug(const char *msg, ...);
        void assert_user_bug(const char *msg);
index 136f4622fb3ff1d16aa59a8b9d41a6c62df2f930..2ef4c4d2f968ef2c97dffbf8f17a3e80c447c9cd 100644 (file)
@@ -6,6 +6,7 @@
 #include "common.h"
 #include "model.h"
 #include "nodestack.h"
+#include "execution.h"
 
 /**
  * Format an "enabled_type_t" for printing
@@ -35,6 +36,7 @@ void enabled_type_to_string(enabled_type_t e, char *str)
 
 /** Constructor */
 Scheduler::Scheduler() :
+       execution(NULL),
        enabled(NULL),
        enabled_len(0),
        curr_thread_index(0),
@@ -42,6 +44,15 @@ Scheduler::Scheduler() :
 {
 }
 
+/**
+ * @brief Register the ModelExecution engine
+ * @param execution The ModelExecution which is controlling execution
+ */
+void Scheduler::register_engine(ModelExecution *execution)
+{
+       this->execution = execution;
+}
+
 void Scheduler::set_enabled(Thread *t, enabled_type_t enabled_status) {
        int threadid = id_to_int(t->get_id());
        if (threadid >= enabled_len) {
@@ -56,7 +67,7 @@ void Scheduler::set_enabled(Thread *t, enabled_type_t enabled_status) {
        }
        enabled[threadid] = enabled_status;
        if (enabled_status == THREAD_DISABLED)
-               model->check_promises_thread_disabled();
+               execution->check_promises_thread_disabled();
 }
 
 /**
index 4c67c28492b9cc24facc2e43827eee2ca198f28d..9b16a7a968f7dcd5f52be8e936467efec29b0c48 100644 (file)
@@ -11,6 +11,7 @@
 /* Forward declaration */
 class Thread;
 class Node;
+class ModelExecution;
 
 typedef enum enabled_type {
        THREAD_DISABLED,
@@ -25,6 +26,8 @@ void enabled_type_to_string(enabled_type_t e, char *str);
 class Scheduler {
 public:
        Scheduler();
+       void register_engine(ModelExecution *execution);
+
        void add_thread(Thread *t);
        void remove_thread(Thread *t);
        void sleep(Thread *t);
@@ -46,6 +49,7 @@ public:
 
        SNAPSHOTALLOC
 private:
+       ModelExecution *execution;
        /** The list of available Threads that are not currently running */
        enabled_type_t *enabled;
        int enabled_len;