summaryrefslogtreecommitdiff
path: root/poll.c
diff options
context:
space:
mode:
authorNiels Provos <provos@gmail.com>2007-07-30 22:41:00 +0000
committerNiels Provos <provos@gmail.com>2007-07-30 22:41:00 +0000
commit3ad6b47e03993f688e92fb202c89e3be984a8f56 (patch)
tree94203af743c25a5726325989ecb2b2f18619595c /poll.c
parentd7918e7963db292b49d575fbd3b9c47f4d59c9cf (diff)
downloadlibevent-3ad6b47e03993f688e92fb202c89e3be984a8f56.tar.gz
make clock_monotonic work; do not use default timeout;
from Scott Lamb, plus some fixes from me. svn:r371
Diffstat (limited to 'poll.c')
-rw-r--r--poll.c9
1 files changed, 6 insertions, 3 deletions
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) {