for (w = (struct ev_child *)childs [chain & (PID_HASHSIZE - 1)]; w; w = (struct ev_child *)((WL)w)->next)
if (w->pid == pid || !w->pid)
{
- w->priority = sw->priority; /* need to do it *now* */
- w->rpid = pid;
- w->rstatus = status;
+ ev_priority (w) = ev_priority (sw); /* need to do it *now* */
+ w->rpid = pid;
+ w->rstatus = status;
event (EV_A_ (W)w, EV_CHILD);
}
}
if (p->w)
{
p->w->pending = 0;
- p->w->cb (EV_A_ p->w, p->events);
+
+ (*(void (**)(EV_P_ W, int))&p->w->cb) (EV_A_ p->w, p->events);
}
}
}
static void
timers_reify (EV_P)
{
- while (timercnt && timers [0]->at <= mn_now)
+ while (timercnt && ((WT)timers [0])->at <= mn_now)
{
struct ev_timer *w = timers [0];
if (w->repeat)
{
assert (("negative ev_timer repeat value found while processing timers", w->repeat > 0.));
- w->at = mn_now + w->repeat;
+ ((WT)w)->at = mn_now + w->repeat;
downheap ((WT *)timers, timercnt, 0);
}
else
static void
periodics_reify (EV_P)
{
- while (periodiccnt && periodics [0]->at <= rt_now)
+ while (periodiccnt && ((WT)periodics [0])->at <= rt_now)
{
struct ev_periodic *w = periodics [0];
/* first reschedule or stop timer */
if (w->interval)
{
- w->at += floor ((rt_now - w->at) / w->interval + 1.) * w->interval;
- assert (("ev_periodic timeout in the past detected while processing timers, negative interval?", w->at > rt_now));
+ ((WT)w)->at += floor ((rt_now - ((WT)w)->at) / w->interval + 1.) * w->interval;
+ assert (("ev_periodic timeout in the past detected while processing timers, negative interval?", ((WT)w)->at > rt_now));
downheap ((WT *)periodics, periodiccnt, 0);
}
else
if (w->interval)
{
- ev_tstamp diff = ceil ((rt_now - w->at) / w->interval) * w->interval;
+ ev_tstamp diff = ceil ((rt_now - ((WT)w)->at) / w->interval) * w->interval;
if (fabs (diff) >= 1e-4)
{
/* adjust timers. this is easy, as the offset is the same for all */
for (i = 0; i < timercnt; ++i)
- timers [i]->at += rt_now - mn_now;
+ ((WT)timers [i])->at += rt_now - mn_now;
}
mn_now = rt_now;
if (timercnt)
{
- ev_tstamp to = timers [0]->at - mn_now + method_fudge;
+ ev_tstamp to = ((WT)timers [0])->at - mn_now + method_fudge;
if (block > to) block = to;
}
if (periodiccnt)
{
- ev_tstamp to = periodics [0]->at - rt_now + method_fudge;
+ ev_tstamp to = ((WT)periodics [0])->at - rt_now + method_fudge;
if (block > to) block = to;
}
if (ev_is_active (w))
return;
- w->at += mn_now;
+ ((WT)w)->at += mn_now;
assert (("ev_timer_start called with negative timer repeat value", w->repeat >= 0.));
downheap ((WT *)timers, timercnt, ((W)w)->active - 1);
}
- w->at = w->repeat;
+ ((WT)w)->at = w->repeat;
ev_stop (EV_A_ (W)w);
}
{
if (w->repeat)
{
- w->at = mn_now + w->repeat;
+ ((WT)w)->at = mn_now + w->repeat;
downheap ((WT *)timers, timercnt, ((W)w)->active - 1);
}
else
/* this formula differs from the one in periodic_reify because we do not always round up */
if (w->interval)
- w->at += ceil ((rt_now - w->at) / w->interval) * w->interval;
+ ((WT)w)->at += ceil ((rt_now - ((WT)w)->at) / w->interval) * w->interval;
ev_start (EV_A_ (W)w, ++periodiccnt);
array_needsize (periodics, periodicmax, periodiccnt, );
array_needsize (signals, signalmax, w->signum, signals_init);
wlist_add ((WL *)&signals [w->signum - 1].head, (WL)w);
- if (!w->next)
+ if (!((WL)w)->next)
{
struct sigaction sa;
sa.sa_handler = sighandler;
void event_set (struct event *ev, int fd, short events, void (*cb)(int, short, void *), void *arg)
{
- printf ("event set %p\n", ev);//D
if (events & EV_SIGNAL)
ev_watcher_init (&ev->iosig.sig, x_cb_sig);
else
int event_add (struct event *ev, struct timeval *tv)
{
- printf ("event add %p %p\n", ev, &ev->to);//D
dLOOPev;
/* disable all watchers */
int event_del (struct event *ev)
{
- printf ("event del %p\n", ev);//D
dLOOPev;
if (ev->ev_events & EV_SIGNAL)
if (ev_is_active (&ev->iosig.sig))
ev_signal_stop (EV_A_ &ev->iosig.sig);
}
- else
+ else if (ev->ev_events & (EV_READ | EV_WRITE))
{
/* io */
if (ev_is_active (&ev->iosig.io))
ev_io_stop (EV_A_ &ev->iosig.io);
}
- printf ("to %p %d\n", &ev->to, ev->to.active);//D
if (ev_is_active (&ev->to))
ev_timer_stop (EV_A_ &ev->to);
if (ev_is_active (&ev->iosig.sig) || ev_is_pending (&ev->iosig.sig))
revents |= EV_SIGNAL;
}
- else
+ else if (ev->ev_events & (EV_READ | EV_WRITE))
{
/* io */
if (ev_is_active (&ev->iosig.io) || ev_is_pending (&ev->iosig.io))