Commit 86e8f721 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Handle the case where we have no timeouts

parent c8eedc29
...@@ -411,6 +411,7 @@ VEV_Once(struct vev_root *evb) ...@@ -411,6 +411,7 @@ VEV_Once(struct vev_root *evb)
if (evb->psig) if (evb->psig)
return (vev_sched_signal(evb)); return (vev_sched_signal(evb));
tmo = INFTIM;
e = binheap_root(evb->binheap); e = binheap_root(evb->binheap);
if (e != NULL) { if (e != NULL) {
CHECK_OBJ_NOTNULL(e, VEV_MAGIC); CHECK_OBJ_NOTNULL(e, VEV_MAGIC);
...@@ -418,11 +419,11 @@ VEV_Once(struct vev_root *evb) ...@@ -418,11 +419,11 @@ VEV_Once(struct vev_root *evb)
t = VTIM_mono(); t = VTIM_mono();
if (e->__when <= t) if (e->__when <= t)
return (vev_sched_timeout(evb, e, t)); return (vev_sched_timeout(evb, e, t));
tmo = (int)((e->__when - t) * 1e3); if (e->__when < 9e99)
tmo = (int)((e->__when - t) * 1e3);
if (tmo == 0) if (tmo == 0)
tmo = 1; tmo = 1;
} else }
tmo = INFTIM;
if (tmo == INFTIM && evb->lpfd == BINHEAP_NOIDX + 1) if (tmo == INFTIM && evb->lpfd == BINHEAP_NOIDX + 1)
return (0); return (0);
...@@ -430,6 +431,8 @@ VEV_Once(struct vev_root *evb) ...@@ -430,6 +431,8 @@ VEV_Once(struct vev_root *evb)
i = poll(evb->pfd + 1, evb->lpfd - 1, tmo); i = poll(evb->pfd + 1, evb->lpfd - 1, tmo);
if (i == -1 && errno == EINTR) if (i == -1 && errno == EINTR)
return (vev_sched_signal(evb)); return (vev_sched_signal(evb));
if (i == -1)
return (-1);
if (i == 0) { if (i == 0) {
assert(e != NULL); assert(e != NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment