demote 'system_thread' to just 'system_context'
[cdsspec-compiler.git] / model.cc
index 9d23788e8939746cd8bf720e2c8ece25e46f8ae7..f1bc320b417e7c7f0938a73d50eff20b2a6b7301 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -50,11 +50,6 @@ int ModelChecker::get_next_id()
        return ++used_thread_id;
 }
 
-void ModelChecker::add_system_thread(Thread *t)
-{
-       this->system_thread = t;
-}
-
 Thread * ModelChecker::schedule_next_thread()
 {
        Thread *t;
@@ -146,7 +141,7 @@ ModelAction * ModelChecker::get_last_conflict(ModelAction *act)
                        continue;
                /* Conflict from the same thread is not really a conflict */
                if (id == prev->get_tid())
-                       return NULL;
+                       continue;
                return prev;
        }
        return NULL;
@@ -197,6 +192,7 @@ void ModelChecker::check_current_action(void)
                DEBUG("trying to push NULL action...\n");
                return;
        }
+       current_action = NULL;
        nextThread = advance_backtracking_state();
        next->set_node(currentNode);
        set_backtracking(next);
@@ -238,14 +234,13 @@ void ModelChecker::remove_thread(Thread *t)
 
 int ModelChecker::switch_to_master(ModelAction *act)
 {
-       Thread *old, *next;
+       Thread *old;
 
        DBG();
        old = thread_current();
        set_current_action(act);
        old->set_state(THREAD_READY);
-       next = system_thread;
-       return old->swap(next);
+       return Thread::swap(old, get_system_context());
 }
 
 ModelAction::ModelAction(action_type_t type, memory_order order, void *loc, int value)