[vlc-devel] [PATCH 1/3] poll: keep already signaled events that are not used between calls

Steve Lhomme robux4 at videolabs.io
Thu Nov 26 17:57:00 CET 2015


---
 compat/poll.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/compat/poll.c b/compat/poll.c
index fa94c93..0b2ae3e 100644
--- a/compat/poll.c
+++ b/compat/poll.c
@@ -130,7 +130,6 @@ int poll(struct pollfd *fds, unsigned nfds, int timeout)
     DWORD ret = WSA_WAIT_FAILED;
     for (unsigned i = 0; i < nfds; i++)
     {
-        SOCKET fd = fds[i].fd;
         long mask = FD_CLOSE;
         fd_set rdset, wrset, exset;
 
@@ -152,7 +151,8 @@ int poll(struct pollfd *fds, unsigned nfds, int timeout)
         if (fds[i].events & POLLPRI)
             mask |= FD_OOB;
 
-        fds[i].revents = 0;
+        /* discard the events we're looking for, keep the other ones */
+        fds[i].revents ^= fds[i].events;
 
         evts[i] = WSACreateEvent();
         if (evts[i] == WSA_INVALID_EVENT)
-- 
2.6.3



More information about the vlc-devel mailing list