threads/model: move switch_to_master from class Thread to class ModelChecker
[model-checker.git] / model.cc
index 42d31b385c5fab84d2bed8eafc54286c1885e510..1015701d917803c75541fb2d3b830a0f223c301c 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -55,6 +55,18 @@ int ModelChecker::add_thread(Thread *t)
        return 0;
 }
 
+int ModelChecker::switch_to_master(ModelAction *act)
+{
+       Thread *old, *next;
+
+       DBG();
+       old = thread_current();
+       set_current_action(act);
+       old->set_state(THREAD_READY);
+       next = system_thread;
+       return old->swap(next);
+}
+
 ModelAction::ModelAction(action_type_t type, memory_order order, void *loc, int value)
 {
        Thread *t = thread_current();