Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Move MSG_parallel_task_create() in msg_task.c.
[simgrid.git] / src / simix / smx_process.c
index 18656fa..1d35e54 100644 (file)
@@ -584,7 +584,8 @@ void SIMIX_post_process_sleep(smx_action_t action)
 
     switch(surf_workstation_model->action_state_get(action->sleep.surf_sleep)){
       case SURF_ACTION_FAILED:
-       SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed");
+        simcall->issuer->context->iwannadie = 1;
+        //SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed");
         break;
 
       case SURF_ACTION_DONE:
@@ -595,9 +596,14 @@ void SIMIX_post_process_sleep(smx_action_t action)
         THROW_IMPOSSIBLE;
         break;
     }
+    if (surf_workstation_model->extension.
+        workstation.get_state(simcall->issuer->smx_host->host) != SURF_RESOURCE_ON) {
+      simcall->issuer->context->iwannadie = 1;
+    }
     simcall->process_sleep.result = state;
     simcall->issuer->waiting_action = NULL;
     SIMIX_simcall_answer(simcall);
+
   }
   SIMIX_process_sleep_destroy(action);
 }
@@ -714,16 +720,11 @@ xbt_dynar_t SIMIX_processes_as_dynar(void) {
   return res;
 }
 void SIMIX_process_on_exit_runall(smx_process_t process) {
-  int cpt;
-  if (!process->on_exit) {
-    return;
-  }
-
-  smx_process_exit_fun_t exit_fun;
+  s_smx_process_exit_fun_t exit_fun;
 
-  for (cpt = xbt_dynar_length(process->on_exit) - 1; cpt >= 0; cpt--) {
-    exit_fun = xbt_dynar_get_ptr(process->on_exit, cpt);
-    (exit_fun->fun)(exit_fun->arg);
+  while (!xbt_dynar_is_empty(process->on_exit)) {
+    exit_fun = xbt_dynar_pop_as(process->on_exit,s_smx_process_exit_fun_t);
+    (exit_fun.fun)(exit_fun.arg);
   }
 }
 void SIMIX_process_on_exit(int_f_pvoid_t fun, void *data) {