From: Samuel Lepetit Date: Wed, 20 Jun 2012 12:36:51 +0000 (+0200) Subject: Use the same way of checking the state of the communication in process_sleep. X-Git-Tag: v3_8~556^2~3 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/1205efea3b6565a8b16a80e0d3e6e30853b66ad0?ds=sidebyside Use the same way of checking the state of the communication in process_sleep. --- diff --git a/src/msg/msg_gos.c b/src/msg/msg_gos.c index 4b5ff6d1da..9f04b7a529 100644 --- a/src/msg/msg_gos.c +++ b/src/msg/msg_gos.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2004-2011. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2004-2012. 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. */ @@ -234,7 +234,7 @@ MSG_error_t MSG_parallel_task_execute(m_task_t task) */ MSG_error_t MSG_process_sleep(double nb_sec) { - e_smx_state_t state; + xbt_ex_t e; /*m_process_t proc = MSG_process_self();*/ #ifdef HAVE_TRACING @@ -242,25 +242,32 @@ MSG_error_t MSG_process_sleep(double nb_sec) #endif /* create action to sleep */ - state = simcall_process_sleep(nb_sec); /*proc->simdata->waiting_action = act_sleep; FIXME: check if not setting the waiting_action breaks something on msg proc->simdata->waiting_action = NULL;*/ - - if (state == SIMIX_DONE) { -#ifdef HAVE_TRACING - TRACE_msg_process_sleep_out(MSG_process_self()); -#endif - MSG_RETURN(MSG_OK); - } else { -#ifdef HAVE_TRACING - TRACE_msg_process_sleep_out(MSG_process_self()); -#endif - MSG_RETURN(MSG_HOST_FAILURE); + + TRY { + simcall_process_sleep(nb_sec); } + CATCH(e) { + switch (e.category) { + case host_error: + #ifdef HAVE_TRACING + TRACE_msg_process_sleep_out(MSG_process_self()); + #endif + MSG_RETURN(MSG_HOST_FAILURE); + break; + default: + RETHROW; + } + } + #ifdef HAVE_TRACING + TRACE_msg_process_sleep_out(MSG_process_self()); + #endif + MSG_RETURN(MSG_OK); } /** \ingroup msg_task_usage diff --git a/src/simix/smx_process.c b/src/simix/smx_process.c index b9d8f8dc46..009e9272d4 100644 --- a/src/simix/smx_process.c +++ b/src/simix/smx_process.c @@ -582,7 +582,7 @@ void SIMIX_post_process_sleep(smx_action_t action) switch(surf_workstation_model->action_state_get(action->sleep.surf_sleep)){ case SURF_ACTION_FAILED: - state = SIMIX_SRC_HOST_FAILURE; + SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed"); break; case SURF_ACTION_DONE: