Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Give back control to maestro as late as possible.
[simgrid.git] / src / kernel / context / ContextThread.cpp
index 85ac35a..012fbcc 100644 (file)
@@ -200,9 +200,9 @@ void ThreadContext::stop()
     xbt_os_sem_release(smx_ctx_thread_sem);
 
   // Signal to the maestro that it has finished:
-  xbt_os_sem_release(this->end_);
-
+  xbt_os_thread_cleanup_push((void (*)(void*))xbt_os_sem_release, this->end_);
   xbt_os_thread_exit(nullptr);
+  xbt_os_thread_cleanup_pop(0);
 }
 
 void ThreadContext::suspend()