Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Bugfix: killall should execute all processes after killing them in order to let them...
[simgrid.git] / src / simix / smx_process.c
index 01a6d29..136a1f6 100644 (file)
@@ -14,7 +14,7 @@
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_process, simix,
                                 "Logging specific to SIMIX (process)");
 
-static unsigned long simix_process_maxpid = 0;
+unsigned long simix_process_maxpid = 0;
 
 /**
  * \brief Returns the current agent.
@@ -36,7 +36,7 @@ XBT_INLINE smx_process_t SIMIX_process_self(void)
 void SIMIX_process_cleanup(smx_process_t process)
 {
   DEBUG1("Cleanup process %s", process->name);
-  xbt_swag_remove(process, simix_global->process_to_run);
+  /*xbt_swag_remove(process, simix_global->process_to_run);*/
   xbt_swag_remove(process, simix_global->process_list);
   xbt_swag_remove(process, process->smx_host->process_list);
   xbt_swag_insert(process, simix_global->process_to_destroy);
@@ -81,6 +81,7 @@ void SIMIX_create_maestro_process()
   maestro->running_ctx = xbt_new(xbt_running_ctx_t, 1);
   XBT_RUNNING_CTX_INITIALIZE(maestro->running_ctx);
   maestro->context = SIMIX_context_new(NULL, 0, NULL, NULL, maestro);
+  maestro->request.issuer = maestro;
 
   simix_global->maestro_process = maestro;
   return;
@@ -172,7 +173,7 @@ smx_process_t SIMIX_process_create(const char *name,
     /* Now insert it in the global process list and in the process to run list */
     xbt_swag_insert(process, simix_global->process_list);
     DEBUG2("Inserting %s(%s) in the to_run list", process->name, host->name);
-    xbt_swag_insert(process, simix_global->process_to_run);
+    xbt_dynar_push_as(simix_global->process_to_run, smx_process_t, process);
   }
 
   return process;
@@ -213,7 +214,7 @@ void SIMIX_process_kill(smx_process_t process, smx_process_t killer) {
        break;
 
       case SIMIX_ACTION_SYNCHRO:
-       SIMIX_synchro_stop_waiting(process, process->request);
+       SIMIX_synchro_stop_waiting(process, &process->request);
        SIMIX_synchro_destroy(process->waiting_action);
        break;
 
@@ -228,7 +229,7 @@ void SIMIX_process_kill(smx_process_t process, smx_process_t killer) {
     SIMIX_context_stop(process->context);
   }
   else {
-    xbt_swag_insert(process, simix_global->process_to_run);
+    xbt_dynar_push_as(simix_global->process_to_run, smx_process_t, process);
   }
 }
 
@@ -244,6 +245,7 @@ void SIMIX_process_killall(void)
   while ((p = xbt_swag_extract(simix_global->process_list)))
     SIMIX_process_kill(p, SIMIX_process_self());
 
+  SIMIX_context_runall(simix_global->process_to_run);
   SIMIX_process_empty_trash();
 }
 
@@ -337,7 +339,7 @@ void SIMIX_process_resume(smx_process_t process, smx_process_t issuer)
       }
     }
     else {
-      xbt_swag_insert(process, simix_global->process_to_run);
+      xbt_dynar_push_as(simix_global->process_to_run, smx_process_t, process);
     }
   }
 }
@@ -402,7 +404,7 @@ int SIMIX_process_is_suspended(smx_process_t process)
 
 int SIMIX_process_is_enabled(smx_process_t process)
 {
-  if (process->request && SIMIX_request_is_enabled(process->request))
+  if (process->request.call != REQ_NO_REQ && SIMIX_request_is_enabled(&process->request))
     return TRUE;
 
   return FALSE;