From: Arnaud Legrand Date: Mon, 2 Apr 2012 23:16:32 +0000 (+0200) Subject: On a timeout we do not wait anymore on a task. X-Git-Tag: v3_7~63^2~10 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/ff0019a9ce0b8b717b8d14f0907004adc804f5c2?hp=9fd3af39c03e516d648a42b9711453e909a3d16f On a timeout we do not wait anymore on a task. -> Avoid keeping a pointer to an invalid object. --- diff --git a/src/simix/smx_user.c b/src/simix/smx_user.c index 1f5f4b4f1a..c0198ab3ed 100644 --- a/src/simix/smx_user.c +++ b/src/simix/smx_user.c @@ -17,6 +17,7 @@ #include "smx_private.h" #include "mc/mc.h" +#include "xbt/ex.h" XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix); @@ -1078,6 +1079,8 @@ void simcall_cond_wait_timeout(smx_cond_t cond, smx_mutex_t mutex, double timeout) { + xbt_ex_t e; + xbt_assert(isfinite(timeout), "timeout is not finite!"); smx_simcall_t simcall = SIMIX_simcall_mine(); @@ -1087,7 +1090,20 @@ void simcall_cond_wait_timeout(smx_cond_t cond, simcall->cond_wait_timeout.mutex = mutex; simcall->cond_wait_timeout.timeout = timeout; - SIMIX_simcall_push(simcall->issuer); + TRY { + SIMIX_simcall_push(simcall->issuer); + } + CATCH(e) { + switch (e.category) { + case timeout_error: + simcall->issuer->waiting_action = NULL; // FIXME: should clean ? + break; + default: + break; + } + RETHROW; + xbt_ex_free(e); + } } void simcall_cond_broadcast(smx_cond_t cond)