Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Change a subclass into a superclass around contexts
[simgrid.git] / src / kernel / context / ContextRaw.cpp
index 3029274..93d7d86 100644 (file)
@@ -297,14 +297,15 @@ void SerialRawContext::suspend()
     XBT_DEBUG("No more process to run");
     next_context = static_cast<SerialRawContext*>(RawContext::get_maestro());
   }
-  SIMIX_context_set_current(next_context);
+  Context::set_current(next_context);
   RawContext::swap(this, next_context);
 }
 
 void SerialRawContext::resume()
 {
-  SIMIX_context_set_current(this);
-  RawContext::swap(RawContext::get_maestro(), this);
+  RawContext* old = static_cast<RawContext*>(self());
+  Context::set_current(this);
+  RawContext::swap(old, this);
 }
 
 void SerialRawContext::run_all()
@@ -367,17 +368,17 @@ void ParallelRawContext::suspend()
     XBT_DEBUG("Restoring worker stack %zu (working threads = %zu)", worker_id_, threads_working_.load());
   }
 
-  SIMIX_context_set_current(next_context);
+  Context::set_current(next_context);
   RawContext::swap(this, next_context);
 }
 
 void ParallelRawContext::resume()
 {
   worker_id_                         = threads_working_.fetch_add(1, std::memory_order_relaxed);
-  ParallelRawContext* worker_context = static_cast<ParallelRawContext*>(SIMIX_context_self());
+  ParallelRawContext* worker_context = static_cast<ParallelRawContext*>(self());
   workers_context_[worker_id_]       = worker_context;
   XBT_DEBUG("Saving worker stack %zu", worker_id_);
-  SIMIX_context_set_current(this);
+  Context::set_current(this);
   RawContext::swap(worker_context, this);
 }