From a31a7360093dd5f4ce1a34b9889560fc37dbb7a9 Mon Sep 17 00:00:00 2001 From: Marek Chalupa Date: Wed, 10 Sep 2014 12:47:13 +0200 Subject: [PATCH] client: wake-up threads on all return paths from read_events 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 Reviewed-by: Pekka Paalanen --- 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 9f817f69..1b7a0466 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;