From: Brian Norris Date: Tue, 16 Apr 2013 02:37:21 +0000 (-0700) Subject: schedule: drop the ModelChecker::check_promises_thread_disabled interface X-Git-Tag: oopsla2013~67^2 X-Git-Url: http://demsky.eecs.uci.edu/git/?p=model-checker.git;a=commitdiff_plain;h=bf80445c97bd34afcfd208cc3ecb31edcd631bb6 schedule: drop the ModelChecker::check_promises_thread_disabled interface --- diff --git a/execution.cc b/execution.cc index fe9175b..8285026 100644 --- a/execution.cc +++ b/execution.cc @@ -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 --- 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); diff --git a/schedule.cc b/schedule.cc index 136f462..2ef4c4d 100644 --- a/schedule.cc +++ b/schedule.cc @@ -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(); } /** diff --git a/schedule.h b/schedule.h index 4c67c28..9b16a7a 100644 --- a/schedule.h +++ b/schedule.h @@ -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;