Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
java: cosmetics
[simgrid.git] / src / kernel / context / ContextThread.cpp
index 5c2e86d..008f641 100644 (file)
@@ -58,9 +58,8 @@ void ThreadContextFactory::run_all()
 
 // ThreadContext
 
-ThreadContext::ThreadContext(std::function<void()> code, void_pfn_smxprocess_t cleanup, smx_actor_t process,
-                             bool maestro)
-    : AttachContext(std::move(code), cleanup, process), is_maestro_(maestro)
+ThreadContext::ThreadContext(std::function<void()> code, void_pfn_smxprocess_t cleanup, smx_actor_t actor, bool maestro)
+    : AttachContext(std::move(code), cleanup, actor), is_maestro_(maestro)
 {
   // We do not need the semaphores when maestro is in main,
   // but creating them anyway simplifies things when maestro is externalized
@@ -116,15 +115,14 @@ void *ThreadContext::wrapper(void *param)
 
   try {
     (*context)();
-    if (not context->is_maestro()) // really?
-      context->Context::stop();
   } catch (StopRequest const&) {
     XBT_DEBUG("Caught a StopRequest");
-    xbt_assert(not context->is_maestro(), "I'm not supposed to be maestro here.");
-  } catch (simgrid::HostFailureException const&) {
-    XBT_DEBUG("Caught an HostFailureException");
+    xbt_assert(not context->is_maestro(), "Maestro shall not receive StopRequests, even when detached.");
+  } catch (simgrid::Exception const& e) {
+    XBT_INFO("Actor killed by an uncatched exception %s", simgrid::xbt::demangle(typeid(e).name()).get());
+    throw;
   }
-  if (not context->is_maestro()) // really?
+  if (not context->is_maestro()) // Just in case somebody detached maestro
     context->Context::stop();
 
   // Signal to the caller (normally the maestro) that we have finished: