Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
more robustness in the code by not ignoring situations that we don't now how to deal...
[simgrid.git] / src / simix / smx_global.c
index 6daaf17..8eb92c7 100644 (file)
@@ -135,6 +135,24 @@ void SIMIX_display_process_status(void)
         free(who);
         who = who2;
       }
+    } else if (process->sem) {
+      who2 =
+        bprintf
+        ("%s Blocked on semaphore %p; Waiting for the following actions:",
+         who,
+         (XBT_LOG_ISENABLED(simix_kernel, xbt_log_priority_verbose)) ?
+         process->sem : (void *) 0xdead);
+      free(who);
+      who = who2;
+      xbt_fifo_foreach(process->sem->actions, item, act, smx_action_t) {
+        who2 =
+          bprintf("%s '%s'(%p)", who, act->name,
+                  (XBT_LOG_ISENABLED(simix_kernel, xbt_log_priority_verbose))
+                  ? act : (void *) 0xdead);
+        free(who);
+        who = who2;
+      }
+
     } else {
       who2 =
         bprintf
@@ -352,14 +370,14 @@ double SIMIX_solve(xbt_fifo_t actions_done, xbt_fifo_t actions_failed)
           xbt_free(args);
           continue;
         }
+
         if (args->kill_time > SIMIX_get_clock()) {
           surf_timer_model->extension.timer.set(args->kill_time, (void *)
                                                 &SIMIX_process_kill,
                                                 (void *) process);
         }
         xbt_free(args);
-      }
-      if (fun == simix_global->create_process_function) {
+      } else if (fun == simix_global->create_process_function) {
         smx_process_arg_t args = arg;
         DEBUG2("Launching %s on %s", args->name, args->hostname);
         process =
@@ -385,15 +403,15 @@ double SIMIX_solve(xbt_fifo_t actions_done, xbt_fifo_t actions_failed)
                                                   (void *) process);
         }
         xbt_free(args);
-      }
-      if (fun == SIMIX_process_kill) {
+      } else if (fun == SIMIX_process_kill) {
         process = arg;
         DEBUG2("Killing %s on %s", process->name, process->smx_host->name);
         SIMIX_process_kill(process);
-      }
-      if (fun == simix_global->kill_process_function) {
+      } else if (fun == simix_global->kill_process_function) {
         process = arg;
         (*simix_global->kill_process_function) (process);
+      } else {
+        THROW_IMPOSSIBLE;
       }
     }