If wl_connection_read returned EAGAIN, we must wake up sleeping
threads. If we don't do this and the thread calling
wl_connection_read won't call wl_display_read_events again,
the sleeping threads will sleep indefinitely.

Signed-off-by: Marek Chalupa <[email protected]>
---
 src/wayland-client.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/wayland-client.c b/src/wayland-client.c
index 9f817f6..1b7a046 100644
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -1152,8 +1152,13 @@ read_events(struct wl_display *display)
        if (display->reader_count == 0) {
                total = wl_connection_read(display->connection);
                if (total == -1) {
-                       if (errno == EAGAIN)
+                       if (errno == EAGAIN) {
+                               /* we must wake up threads whenever
+                                * the reader_count dropped to 0 */
+                               display_wakeup_threads(display);
+
                                return 0;
+                       }
 
                        display_fatal_error(display, errno);
                        return -1;
-- 
1.9.3

_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to