uloop: fix infinite waiting with kqueue
This commit is contained in:
parent
d110a016e3
commit
869fc39f50
1 changed files with 2 additions and 5 deletions
7
uloop.c
7
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;
|
||||
|
|
Loading…
Reference in a new issue