Michel Dänzer <[email protected]> writes:

> I'm afraid that doesn't explain the ClientReady-after-CloseDownClient
> case in https://bugs.freedesktop.org/attachment.cgi?id=131278 though, so
> there might still be another (possibly pre-existing) bug.

Agreed. I wonder if that might not be just flushing the set of
closed epoll data while there are still epoll entries for them. How
about this?

From b573c532223610cfc256ef5f6f7cee1512c7f383 Mon Sep 17 00:00:00 2001
From: Keith Packard <[email protected]>
Date: Thu, 11 May 2017 07:13:53 -0700
Subject: [PATCH xserver] os: Wait to clean deleted epoll entries until epoll
 is idle

Make sure there are no epoll entries in the kernel before
clearing the queue of deleted ones.

Signed-off-by: Keith Packard <[email protected]>
---
 os/ospoll.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/os/ospoll.c b/os/ospoll.c
index 51bd02dc7..2fbfd6706 100644
--- a/os/ospoll.c
+++ b/os/ospoll.c
@@ -394,6 +394,8 @@ ospoll_wait(struct ospoll *ospoll, int timeout)
     struct epoll_event events[MAX_EVENTS];
     int i;
 
+    if (!xorg_list_is_empty(&ospoll->deleted))
+        timeout = 0;
     nready = epoll_wait(ospoll->epoll_fd, events, MAX_EVENTS, timeout);
     for (i = 0; i < nready; i++) {
         struct epoll_event *ev = &events[i];
@@ -411,7 +413,8 @@ ospoll_wait(struct ospoll *ospoll, int timeout)
         if (osfd->callback)
             osfd->callback(osfd->fd, xevents, osfd->data);
     }
-    ospoll_clean_deleted(ospoll);
+    if (nready == 0)
+        ospoll_clean_deleted(ospoll);
 #endif
 #if POLL
     nready = xserver_poll(ospoll->fds, ospoll->num, timeout);
-- 
2.11.0

-- 
-keith

Attachment: signature.asc
Description: PGP signature

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to