Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add convenient debug function on conditions and use it in simix.
authoralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 12 Jun 2008 09:38:58 +0000 (09:38 +0000)
committeralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 12 Jun 2008 09:38:58 +0000 (09:38 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5610 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/include/simix/simix.h
src/msg/msg_mailbox.c
src/simix/smx_synchro.c

index ba97ccf..4bf6348 100644 (file)
@@ -127,7 +127,7 @@ XBT_PUBLIC(void) SIMIX_cond_wait_timeout(smx_cond_t cond,smx_mutex_t mutex, doub
 XBT_PUBLIC(void) SIMIX_cond_broadcast(smx_cond_t cond);
 XBT_PUBLIC(void) SIMIX_cond_destroy(smx_cond_t cond);
 XBT_PUBLIC(xbt_fifo_t) SIMIX_cond_get_actions(smx_cond_t cond);
-
+XBT_PUBLIC(void) SIMIX_cond_display_info(smx_cond_t cond);
 
 /************************** Action handling ************************************/
 XBT_PUBLIC(smx_action_t) SIMIX_action_communicate(smx_host_t sender,smx_host_t receiver, const char *name,
index 22c8fb4..2dddabf 100644 (file)
@@ -214,9 +214,12 @@ MSG_mailbox_get_task_ext(msg_mailbox_t mailbox, m_task_t * task,
       }
     }
 
-    xbt_assert1(!MSG_mailbox_get_cond(mailbox),
-               "A process is already blocked on the channel %s",
+    if (MSG_mailbox_get_cond(mailbox)) {
+      CRITICAL1("A process is already blocked on the channel %s",
                MSG_mailbox_get_alias(mailbox));
+      SIMIX_cond_display_info(MSG_mailbox_get_cond(mailbox));
+      xbt_die("Go fix your code!");
+    }
 
     cond = SIMIX_cond_init();
 
index 74fd1f0..64d4d69 100644 (file)
@@ -315,3 +315,17 @@ void SIMIX_cond_destroy(smx_cond_t cond)
     return;
   }
 }
+
+void SIMIX_cond_display_info(smx_cond_t cond)
+{
+  if (cond == NULL)
+    return;
+  else {
+    smx_process_t process = NULL;
+
+    INFO0("Blocked process on this condition:");
+    xbt_swag_foreach(process,cond->sleeping) {
+      INFO2("\t %s running on host %s",process->name,process->simdata->smx_host->name);
+    }
+  }
+}