From 3ad6b47e03993f688e92fb202c89e3be984a8f56 Mon Sep 17 00:00:00 2001 From: Niels Provos Date: Mon, 30 Jul 2007 22:41:00 +0000 Subject: make clock_monotonic work; do not use default timeout; from Scott Lamb, plus some fixes from me. svn:r371 --- poll.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'poll.c') diff --git a/poll.c b/poll.c index 84885984..123d36a5 100644 --- a/poll.c +++ b/poll.c @@ -148,13 +148,16 @@ poll_check_ok(struct pollop *pop) int poll_dispatch(struct event_base *base, void *arg, struct timeval *tv) { - int res, i, sec, nfds; + int res, i, msec = -1, nfds; struct pollop *pop = arg; poll_check_ok(pop); - sec = tv->tv_sec * 1000 + (tv->tv_usec + 999) / 1000; + + if (tv != NULL) + msec = tv->tv_sec * 1000 + (tv->tv_usec + 999) / 1000; + nfds = pop->nfds; - res = poll(pop->event_set, nfds, sec); + res = poll(pop->event_set, nfds, msec); if (res == -1) { if (errno != EINTR) { -- cgit v1.2.1