/* 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 */
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);
#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();
}
/**
/* Forward declaration */
class Thread;
class Node;
+class ModelExecution;
typedef enum enabled_type {
THREAD_DISABLED,
class Scheduler {
public:
Scheduler();
+ void register_engine(ModelExecution *execution);
+
void add_thread(Thread *t);
void remove_thread(Thread *t);
void sleep(Thread *t);
SNAPSHOTALLOC
private:
+ ModelExecution *execution;
/** The list of available Threads that are not currently running */
enabled_type_t *enabled;
int enabled_len;