From: alegrand Date: Thu, 12 Jun 2008 09:38:58 +0000 (+0000) Subject: Add convenient debug function on conditions and use it in simix. X-Git-Tag: v3.3~369 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/311d21362aff192fe4d49d8cc6ed907e9e3f8fb0 Add convenient debug function on conditions and use it in simix. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5610 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/include/simix/simix.h b/src/include/simix/simix.h index ba97ccf5e9..4bf6348aa7 100644 --- a/src/include/simix/simix.h +++ b/src/include/simix/simix.h @@ -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, diff --git a/src/msg/msg_mailbox.c b/src/msg/msg_mailbox.c index 22c8fb4ad7..2dddabfedb 100644 --- a/src/msg/msg_mailbox.c +++ b/src/msg/msg_mailbox.c @@ -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(); diff --git a/src/simix/smx_synchro.c b/src/simix/smx_synchro.c index 74fd1f0707..64d4d699eb 100644 --- a/src/simix/smx_synchro.c +++ b/src/simix/smx_synchro.c @@ -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); + } + } +}