From 625fca10d205608488a33657f398f8355cc8575d Mon Sep 17 00:00:00 2001 From: mquinson Date: Fri, 16 May 2008 16:08:54 +0000 Subject: [PATCH] Sometimes, the time to wait is soo small that the increment does not change the global clock (for example, 100000 + 10E-15=100000). Add an epsilon to the wait to avoid the issue. I'm still not completely sure that the fix is 100% effective (because 10E300 + 1 = 10E300), but I don't have any better idea git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5436 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- src/gras/Msg/gras_msg_exchange.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gras/Msg/gras_msg_exchange.c b/src/gras/Msg/gras_msg_exchange.c index bb894e03b3..0cafee709c 100644 --- a/src/gras/Msg/gras_msg_exchange.c +++ b/src/gras/Msg/gras_msg_exchange.c @@ -270,6 +270,7 @@ gras_msg_handleall(double period) { do { now=gras_os_time(); + TRY{ if (period - now + begin > 0) gras_msg_handle(period - now + begin); @@ -278,7 +279,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 (now - begin < period - 0.000001); } /** @brief Handle an incomming message or timer (or wait up to \a timeOut seconds) -- 2.20.1