X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a2b090ca3f05b6cf0dd7f095c27791f93f1c1555..6c70be774ea7f214c9945645ddcb11bbdb5ef33a:/src/gras/Msg/gras_msg_exchange.c diff --git a/src/gras/Msg/gras_msg_exchange.c b/src/gras/Msg/gras_msg_exchange.c index 89b7cbf61d..ba36513fef 100644 --- a/src/gras/Msg/gras_msg_exchange.c +++ b/src/gras/Msg/gras_msg_exchange.c @@ -48,7 +48,7 @@ gras_msg_wait_ext_(double timeout, double start, now; gras_msg_procdata_t pd= (gras_msg_procdata_t)gras_libdata_by_id(gras_msg_libdata_id); - int cpt; + unsigned int cpt; xbt_assert0(msg_got,"msg_got is an output parameter"); @@ -91,11 +91,7 @@ gras_msg_wait_ext_(double timeout, memset(&msg,sizeof(msg),0); TRY { - xbt_queue_shift_timed(pd->msg_received,&msg,timeout ? timeout - now + start : 0); - /* - msg.expe = gras_trp_select(timeout ? timeout - now + start : 0); - gras_msg_recv(msg.expe, &msg); - */ + xbt_queue_shift_timed(pd->msg_received,&msg,timeout ? timeout - now + start : 0); } CATCH(e) { if (e.category == system_error && !strncmp("Socket closed by remote side",e.msg, @@ -282,7 +278,8 @@ gras_msg_handleall(double period) { RETHROW0("Error while waiting for messages: %s"); xbt_ex_free(e); } - } while (now - begin < period); + /* Epsilon to avoid numerical stability issues were the waited interval is so small that the global clock cannot notice the increment */ + } while (period - now + begin > 0); } /** @brief Handle an incomming message or timer (or wait up to \a timeOut seconds) @@ -299,7 +296,7 @@ gras_msg_handle(double timeOut) { double untiltimer; - int cpt; + unsigned int cpt; int volatile ran_ok; s_gras_msg_t msg; @@ -445,7 +442,7 @@ gras_msg_handle(double timeOut) { "AND IN SIMGRID (process wasn't killed by an assert)",msg.type->name); if (!ran_ok) THROW1(mismatch_error,0, - "Message '%s' refused by all registered callbacks", msg.type->name); + "Message '%s' refused by all registered callbacks (maybe your callback misses a 'return 0' at the end)", msg.type->name); /* FIXME: gras_datadesc_free not implemented => leaking the payload */ break;