Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix segfault when exiting without running the simulation.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sun, 15 Oct 2017 13:48:57 +0000 (15:48 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sun, 15 Oct 2017 13:48:57 +0000 (15:48 +0200)
A big warning is issued instead: not sure that it's sufficient for bug #230
to be closed.

src/simix/smx_global.cpp

index b54b7cb..d612436 100644 (file)
@@ -264,6 +264,15 @@ void SIMIX_clean()
   if (smx_cleaned)
     return; // to avoid double cleaning by java and C
 
+  smx_cleaned = 1;
+  XBT_DEBUG("SIMIX_clean called. Simulation's over.");
+  if (not simix_global->process_to_run.empty() && SIMIX_get_clock() <= 0.0) {
+    XBT_CRITICAL("   ");
+    XBT_CRITICAL("The time is still 0, and you still have processes ready to run.");
+    XBT_CRITICAL("It seems that you forgot to run the simulation that you setup.");
+    xbt_die("Bailing out to avoid that stop-before-start madness. Please fix your code.");
+  }
+
 #if HAVE_SMPI
   if (SIMIX_process_count()>0){
     if(smpi_process()->initialized()){
@@ -275,14 +284,6 @@ void SIMIX_clean()
   }
 #endif
 
-  smx_cleaned = 1;
-  XBT_DEBUG("SIMIX_clean called. Simulation's over.");
-  if (not simix_global->process_to_run.empty() && SIMIX_get_clock() <= 0.0) {
-    XBT_CRITICAL("   ");
-    XBT_CRITICAL("The time is still 0, and you still have processes ready to run.");
-    XBT_CRITICAL("It seems that you forgot to run the simulation that you setup.");
-    xbt_die("Bailing out to avoid that stop-before-start madness. Please fix your code.");
-  }
   /* Kill all processes (but maestro) */
   SIMIX_process_killall(simix_global->maestro_process, 1);
   SIMIX_context_runall();