#include "common.h"
#include "model.h"
#include "nodestack.h"
+#include "execution.h"
/**
* Format an "enabled_type_t" for printing
/** Constructor */
Scheduler::Scheduler() :
+ execution(NULL),
enabled(NULL),
enabled_len(0),
curr_thread_index(0),
{
}
+/**
+ * @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) {
}
enabled[threadid] = enabled_status;
if (enabled_status == THREAD_DISABLED)
- model->check_promises_thread_disabled();
+ execution->check_promises_thread_disabled();
}
/**
/**
* @brief Select a Thread to run via round-robin
+ *
+ * @param n The current Node, holding priority information for the next thread
+ * selection
+ *
* @return The next Thread to run
*/
-Thread * Scheduler::select_next_thread()
+Thread * Scheduler::select_next_thread(Node *n)
{
int old_curr_thread = curr_thread_index;
- Node *n = model->get_curr_node();
bool have_enabled_thread_with_priority = false;
if (model->params.fairwindow != 0) {
*/
void Scheduler::set_current_thread(Thread *t)
{
- ASSERT(t && !t->is_model_thread());
+ ASSERT(!t || !t->is_model_thread());
current = t;
if (DBG_ENABLED())