From 869fc39f50473e135a6be72b13a10f987e46c57b Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 6 Dec 2010 01:16:59 +0100 Subject: [PATCH] uloop: fix infinite waiting with kqueue --- uloop.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/uloop.c b/uloop.c index 4d4b223..ec37925 100644 --- a/uloop.c +++ b/uloop.c @@ -116,15 +116,12 @@ static void uloop_run_events(int timeout) struct timespec ts; int nfds, n; - if (timeout < 0) { - ts.tv_sec = 0; - ts.tv_nsec = 0; - } else { + if (timeout > 0) { ts.tv_sec = timeout / 1000; ts.tv_nsec = timeout * 1000000; } - nfds = kevent(poll_fd, NULL, 0, events, ARRAY_SIZE(events), &ts); + nfds = kevent(poll_fd, NULL, 0, events, ARRAY_SIZE(events), timeout > 0 ? &ts : NULL); for(n = 0; n < nfds; ++n) { struct uloop_fd *u = events[n].udata; -- 2.11.0