summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root>2008-04-09 22:33:55 +0000
committerroot <root>2008-04-09 22:33:55 +0000
commitedb259736d6287eefe424b817fdbc9bd55a611fc (patch)
tree4555716eceb551b61a69e001deb6968607f3cff9
parent03f02a76c6e1b5786c8afa4e95d8d72e2a91a915 (diff)
*** empty log message ***
-rw-r--r--Changes2
-rw-r--r--ev_poll.c24
2 files changed, 13 insertions, 13 deletions
diff --git a/Changes b/Changes
index 7ae2943..f7f6592 100644
--- a/Changes
+++ b/Changes
@@ -2,6 +2,8 @@ Revision history for libev, a high-performance and full-featured event loop.
- event_base_loopexit should return 0 on success
(W.C.A. Wijngaards).
+ - work around poll() potentially not clearing revents
+ field in ev_poll (Brandon Black).
- added linux eventfd support.
- try to autodetect epoll and inotify support
by libc header version if not using autoconf.
diff --git a/ev_poll.c b/ev_poll.c
index 388aec0..a8fdebc 100644
--- a/ev_poll.c
+++ b/ev_poll.c
@@ -97,20 +97,18 @@ poll_poll (EV_P_ ev_tstamp timeout)
fd_enomem (EV_A);
else if (errno != EINTR)
syserr ("(libev) poll");
-
- return;
}
-
- for (i = 0; i < pollcnt; ++i)
- if (expect_false (polls [i].revents & POLLNVAL))
- fd_kill (EV_A_ polls [i].fd);
- else
- fd_event (
- EV_A_
- polls [i].fd,
- (polls [i].revents & (POLLOUT | POLLERR | POLLHUP) ? EV_WRITE : 0)
- | (polls [i].revents & (POLLIN | POLLERR | POLLHUP) ? EV_READ : 0)
- );
+ else if (res > 0)
+ for (i = 0; i < pollcnt; ++i)
+ if (expect_false (polls [i].revents & POLLNVAL))
+ fd_kill (EV_A_ polls [i].fd);
+ else
+ fd_event (
+ EV_A_
+ polls [i].fd,
+ (polls [i].revents & (POLLOUT | POLLERR | POLLHUP) ? EV_WRITE : 0)
+ | (polls [i].revents & (POLLIN | POLLERR | POLLHUP) ? EV_READ : 0)
+ );
}
int inline_size