projects
/
model-checker.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
README: convert to Markdown format
[model-checker.git]
/
schedule.cc
diff --git
a/schedule.cc
b/schedule.cc
index 1eb57d7515823012c51026db219af0e6e9bf0a77..2ef4c4d2f968ef2c97dffbf8f17a3e80c447c9cd 100644
(file)
--- a/
schedule.cc
+++ b/
schedule.cc
@@
-6,6
+6,7
@@
#include "common.h"
#include "model.h"
#include "nodestack.h"
#include "common.h"
#include "model.h"
#include "nodestack.h"
+#include "execution.h"
/**
* Format an "enabled_type_t" for printing
/**
* 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() :
/** Constructor */
Scheduler::Scheduler() :
+ execution(NULL),
enabled(NULL),
enabled_len(0),
curr_thread_index(0),
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) {
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)
}
enabled[threadid] = enabled_status;
if (enabled_status == THREAD_DISABLED)
-
model
->check_promises_thread_disabled();
+
execution
->check_promises_thread_disabled();
}
/**
}
/**
@@
-195,12
+206,15
@@
void Scheduler::wake(Thread *t)
/**
* @brief Select a Thread to run via round-robin
/**
* @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
*/
* @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;
{
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) {
bool have_enabled_thread_with_priority = false;
if (model->params.fairwindow != 0) {
@@
-250,7
+264,7
@@
void Scheduler::set_scheduler_thread(thread_id_t tid) {
*/
void Scheduler::set_current_thread(Thread *t)
{
*/
void Scheduler::set_current_thread(Thread *t)
{
- ASSERT(
t &&
!t->is_model_thread());
+ ASSERT(
!t ||
!t->is_model_thread());
current = t;
if (DBG_ENABLED())
current = t;
if (DBG_ENABLED())