struct ev_loop
{
ev_tstamp ev_rt_now;
+ #define ev_rt_now ((loop)->ev_rt_now)
#define VAR(name,decl) decl;
#include "ev_vars.h"
#undef VAR
}
inline void
-adjustheap (WT *heap, int N, int k, ev_tstamp at)
+adjustheap (WT *heap, int N, int k)
{
- ev_tstamp old_at = heap [k]->at;
- heap [k]->at = at;
-
- if (old_at < at)
- downheap (heap, N, k);
- else
- upheap (heap, k);
+ upheap (heap, k);
+ downheap (heap, N, k);
}
/*****************************************************************************/
if (((W)w)->active < timercnt--)
{
timers [((W)w)->active - 1] = timers [timercnt];
- downheap ((WT *)timers, timercnt, ((W)w)->active - 1);
+ adjustheap ((WT *)timers, timercnt, ((W)w)->active - 1);
}
((WT)w)->at -= mn_now;
if (ev_is_active (w))
{
if (w->repeat)
- adjustheap ((WT *)timers, timercnt, ((W)w)->active - 1, mn_now + w->repeat);
+ {
+ ((WT)w)->at = mn_now + w->repeat;
+ adjustheap ((WT *)timers, timercnt, ((W)w)->active - 1);
+ }
else
ev_timer_stop (EV_A_ w);
}
if (((W)w)->active < periodiccnt--)
{
periodics [((W)w)->active - 1] = periodics [periodiccnt];
- downheap ((WT *)periodics, periodiccnt, ((W)w)->active - 1);
+ adjustheap ((WT *)periodics, periodiccnt, ((W)w)->active - 1);
}
ev_stop (EV_A_ (W)w);