[PATCH xserver 2/2] os: Clear saved poll events in listen so that edge triggering works

Keith Packard keithp at keithp.com
Wed Sep 21 23:53:46 UTC 2016


When a client is marked as write blocked, clear any old 'write ready'
bit in the osfds structure so that a new indication of write ready
(which is marked as edge trigggered) will trigger the callback.

Signed-off-by: Keith Packard <keithp at keithp.com>
---
 os/ospoll.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/os/ospoll.c b/os/ospoll.c
index b00d422..51bd02d 100644
--- a/os/ospoll.c
+++ b/os/ospoll.c
@@ -352,10 +352,14 @@ ospoll_listen(struct ospoll *ospoll, int fd, int xevents)
         epoll_mod(ospoll, osfd);
 #endif
 #if POLL
-        if (xevents & X_NOTIFY_READ)
+        if (xevents & X_NOTIFY_READ) {
             ospoll->fds[pos].events |= POLLIN;
-        if (xevents & X_NOTIFY_WRITE)
+            ospoll->osfds[pos].revents &= ~POLLIN;
+        }
+        if (xevents & X_NOTIFY_WRITE) {
             ospoll->fds[pos].events |= POLLOUT;
+            ospoll->osfds[pos].revents &= ~POLLOUT;
+        }
 #endif
     }
 }
-- 
2.9.3



More information about the xorg-devel mailing list