-
- for (cursor=0; cursor < xbt_dynar_length(pd->timers); cursor++) {
- double untilthis;
-
- timer = xbt_dynar_get_ptr (pd->timers, cursor);
- untilthis = timer->expiry - now;
-
- 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(),
- timer->repeat ? "repetitive" : "delayed", timer->action,
- timer->expiry, now);
-
- 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;
- }
+
+ for (cursor = 0; cursor < xbt_dynar_length(pd->timers); cursor++) {
+ double untilthis;
+
+ timer = xbt_dynar_get_ptr(pd->timers, cursor);
+ untilthis = timer->expiry - now;
+
+ 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(),
+ timer->repeat ? "repetitive" : "delayed", timer->action,
+ timer->expiry, now);
+
+ 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;
+ }