Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
First running version after the relocation of the context module [Cristian]
[simgrid.git] / src / gras / Virtu / sg_process.c
index 8514845..218b447 100644 (file)
@@ -96,9 +96,16 @@ void gras_process_exit()
   VERB2("GRAS: Finalizing process '%s' (%d)",
         SIMIX_process_get_name(SIMIX_process_self()), gras_os_getpid());
 
-  if (xbt_dynar_length(msg_pd->msg_queue))
-    WARN1("process %d terminated, but some messages are still queued",
-          gras_os_getpid());
+  if (xbt_dynar_length(msg_pd->msg_queue)) {
+    unsigned int cpt;
+    s_gras_msg_t msg;
+    WARN2("process %d terminated, but %ld messages are still queued. Message list:",
+          gras_os_getpid(),xbt_dynar_length(msg_pd->msg_queue));
+    xbt_dynar_foreach(msg_pd->msg_queue,cpt, msg) {
+      WARN5("   Message %s (%s) from %s@%s:%d",msg.type->name,e_gras_msg_kind_names[msg.kind],
+          gras_socket_peer_proc(msg.expe),gras_socket_peer_name(msg.expe),gras_socket_peer_port(msg.expe));
+    }
+  }
 
   /* if each process has its sockets list, we need to close them when the
      process finish */
@@ -165,7 +172,7 @@ const char *xbt_procname(void)
 {
   const char *res = NULL;
   smx_process_t process = SIMIX_process_self();
-  if ((process != NULL) && (process->simdata))
+  if (process != NULL)
     res = SIMIX_process_get_name(process);
   if (res)
     return res;
@@ -175,16 +182,18 @@ const char *xbt_procname(void)
 
 int gras_os_getpid(void)
 {
-
+  gras_procdata_t *data;
   smx_process_t process = SIMIX_process_self();
-
-  if ((process != NULL) && (process->data))
-    return ((gras_procdata_t *) process->data)->pid;
-  else
-    return 0;
+  
+  if (process != NULL){
+    data = (gras_procdata_t *)SIMIX_process_get_data(process);
+    if(data != NULL)
+      return data->pid;
+  }
+  
+  return 0;
 }
 
-
 /** @brief retrieve the value of a given host property (or NULL if not defined) */
 const char *gras_os_host_property_value(const char *name)
 {
@@ -229,7 +238,6 @@ void gras_function_register(const char *name, xbt_main_func_t code)
 
 void gras_main()
 {
-  smx_cond_t cond = NULL;
   smx_action_t action;
   xbt_fifo_t actions_done = xbt_fifo_new();
   xbt_fifo_t actions_failed = xbt_fifo_new();
@@ -241,19 +249,15 @@ void gras_main()
 
   while (SIMIX_solve(actions_done, actions_failed) != -1.0) {
     while ((action = xbt_fifo_pop(actions_failed))) {
-      DEBUG1("** %s failed **", action->name);
-      while ((cond = xbt_fifo_pop(action->cond_list))) {
-        SIMIX_cond_broadcast(cond);
-      }
+      DEBUG1("** %s failed **", SIMIX_action_get_name(action));
+      SIMIX_action_signal_all (action);
       /* action finished, destroy it */
       //        SIMIX_action_destroy(action);
     }
 
     while ((action = xbt_fifo_pop(actions_done))) {
-      DEBUG1("** %s done **", action->name);
-      while ((cond = xbt_fifo_pop(action->cond_list))) {
-        SIMIX_cond_broadcast(cond);
-      }
+      DEBUG1("** %s done **", SIMIX_action_get_name(action));
+      SIMIX_action_signal_all (action);
       /* action finished, destroy it */
       //SIMIX_action_destroy(action);
     }