Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
unify how threaded and parallelisable context factories find context_self
[simgrid.git] / src / kernel / context / ContextThread.cpp
index ab20215..c93e361 100644 (file)
@@ -78,7 +78,7 @@ ThreadContext::ThreadContext(std::function<void()> code, void_pfn_smxprocess_t c
 
   /* Otherwise, we attach to the current thread */
   else {
-    xbt_os_thread_set_extra_data(this);
+    SIMIX_context_set_current(this);
   }
 }
 
@@ -91,6 +91,7 @@ ThreadContext::~ThreadContext()
 void *ThreadContext::wrapper(void *param)
 {
   ThreadContext* context = static_cast<ThreadContext*>(param);
+  SIMIX_context_set_current(context);
 
 #ifndef WIN32
   /* Install alternate signal stack, for SIGSEGV handler. */
@@ -177,7 +178,7 @@ void ThreadContext::attach_stop()
   ThreadContext* maestro = (ThreadContext*)simix_global->maestro_process->context_;
   maestro->end_.acquire();
 
-  xbt_os_thread_set_extra_data(nullptr);
+  SIMIX_context_set_current(nullptr);
 }
 
 // SerialThreadContext