From: mquinson Date: Sun, 16 Jul 2006 18:49:26 +0000 (+0000) Subject: Reintenting (sorry), plus do the list managment operation before calling the user... X-Git-Tag: v3.3~2763 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/31b5ce77dbe7b94afee1b8ded57b8b91d8f3c970?ds=inline Reintenting (sorry), plus do the list managment operation before calling the user action (since it could interact with the list, too) git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@2596 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/gras/Msg/timer.c b/src/gras/Msg/timer.c index 513b289613..63b6ce0d65 100644 --- a/src/gras/Msg/timer.c +++ b/src/gras/Msg/timer.c @@ -150,22 +150,23 @@ double gras_msg_timer_handle(void) { DEBUG2("Action %p expires in %f", timer->action, untilthis); if (untilthis <= 0.0) { + void_f_void_t action = timer->action; - DEBUG5("[%.0f] Serve %s action %p (%f<%f)",gras_os_time(), + DEBUG5("[%.0f] Serve %s action %p (%f<%f)",gras_os_time(), timer->repeat ? "repetitive" : "delayed", timer->action, timer->expiry, now); - timer->action(); - if (timer->repeat) { - timer->expiry = now + timer->period; - DEBUG4("[%.0f] Re-arm repetitive action %p for %f (period=%f)", - gras_os_time(), - timer->action, timer->expiry, timer->period); - } else { - DEBUG2("[%.0f] Remove %p now that it's done", gras_os_time(), timer->action); - xbt_dynar_cursor_rm(pd->timers, &cursor); - } - return 0.0; + if (timer->repeat) { + timer->expiry = now + timer->period; + DEBUG4("[%.0f] Re-arm repetitive action %p for %f (period=%f)", + gras_os_time(), + timer->action, timer->expiry, timer->period); + } else { + DEBUG2("[%.0f] Remove %p now that it's done", gras_os_time(), timer->action); + xbt_dynar_cursor_rm(pd->timers, &cursor); + } + action(); + return 0.0; } else if (untilthis < untilnext || untilnext == -1) { untilnext = untilthis; }