From: Arnaud Giersch Date: Sat, 2 Feb 2013 23:57:32 +0000 (+0100) Subject: Don't let exceptions pass through the MSG layer. X-Git-Tag: v3_9_90~520 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/322f5f25b4b082304c755b624909f953aa7a5a1e Don't let exceptions pass through the MSG layer. --- diff --git a/src/msg/msg_gos.c b/src/msg/msg_gos.c index d5ba36ef22..d765c85b88 100644 --- a/src/msg/msg_gos.c +++ b/src/msg/msg_gos.c @@ -125,6 +125,7 @@ msg_error_t MSG_parallel_task_execute(msg_task_t task) */ msg_error_t MSG_process_sleep(double nb_sec) { + xbt_ex_t e; msg_error_t status = MSG_OK; /*msg_process_t proc = MSG_process_self();*/ @@ -140,7 +141,19 @@ msg_error_t MSG_process_sleep(double nb_sec) proc->simdata->waiting_action = NULL;*/ - simcall_process_sleep(nb_sec); + TRY { + simcall_process_sleep(nb_sec); + } + CATCH(e) { + switch (e.category) { + case cancel_error: + status = MSG_TASK_CANCELED; + break; + default: + RETHROW; + } + xbt_ex_free(e); + } #ifdef HAVE_TRACING TRACE_msg_process_sleep_out(MSG_process_self()); @@ -249,11 +262,26 @@ msg_error_t MSG_task_receive_ext(msg_task_t * task, const char *alias, double timeout, msg_host_t host) { + xbt_ex_t e; + msg_error_t ret; XBT_DEBUG ("MSG_task_receive_ext: Trying to receive a message on mailbox '%s'", alias); - return MSG_mailbox_get_task_ext(MSG_mailbox_get_by_alias(alias), task, - host, timeout); + TRY { + ret = MSG_mailbox_get_task_ext(MSG_mailbox_get_by_alias(alias), task, + host, timeout); + } + CATCH(e) { + switch (e.category) { + case cancel_error: /* may be thrown by MSG_mailbox_get_by_alias */ + ret = MSG_HOST_FAILURE; + break; + default: + RETHROW; + } + xbt_ex_free(e); + } + return ret; } /** \ingroup msg_task_usage diff --git a/src/msg/msg_mailbox.c b/src/msg/msg_mailbox.c index 942f332433..1abbf0ee2d 100644 --- a/src/msg/msg_mailbox.c +++ b/src/msg/msg_mailbox.c @@ -116,6 +116,9 @@ MSG_mailbox_get_task_ext(msg_mailbox_t mailbox, msg_task_t * task, } CATCH(e) { switch (e.category) { + case cancel_error: + ret = MSG_HOST_FAILURE; + break; case network_error: ret = MSG_TRANSFER_FAILURE; break; @@ -183,6 +186,9 @@ MSG_mailbox_put_with_timeout(msg_mailbox_t mailbox, msg_task_t task, CATCH(e) { switch (e.category) { + case cancel_error: + ret = MSG_HOST_FAILURE; + break; case network_error: ret = MSG_TRANSFER_FAILURE; break;