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 fe9175b..8285026 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 be53ec3..cfc6528 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 136f462..2ef4c4d 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 4c67c28..9b16a7a 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;