X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d0d4cc7697e64b5092445d666a1e11712044d69d..f757db3e61c8c5cbcab605a1beba36b5e21dc6f9:/src/msg/msg_gos.c diff --git a/src/msg/msg_gos.c b/src/msg/msg_gos.c index 7eb2d791e2..339f73d89a 100644 --- a/src/msg/msg_gos.c +++ b/src/msg/msg_gos.c @@ -1,4 +1,5 @@ -/* Copyright (c) 2004-2012. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2004-2013. The SimGrid Team. + * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -125,6 +126,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 +142,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()); @@ -304,11 +318,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 = MSG_OK; 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 @@ -594,7 +623,7 @@ msg_comm_t MSG_task_irecv_bounded(msg_task_t *task, const char *name, double rat smx_rdv_t rdv = MSG_mailbox_get_by_alias(name); - simcall_comm_change_rate_first_action(rdv,rate); + /* FIXME: these functions are not traceable */ /* Sanity check */ @@ -609,7 +638,7 @@ msg_comm_t MSG_task_irecv_bounded(msg_task_t *task, const char *name, double rat comm->task_sent = NULL; comm->task_received = task; comm->status = MSG_OK; - comm->s_comm = simcall_comm_irecv(rdv, task, NULL, NULL, NULL); + comm->s_comm = simcall_comm_irecv_bounded(rdv, task, NULL, NULL, NULL, rate); return comm; }