[PATCH 2/3] client: wake-up threads on all return paths from read_events
Marek Chalupa
mchqwerty at gmail.com
Wed Sep 10 03:47:13 PDT 2014
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 <mchqwerty at gmail.com>
---
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
More information about the wayland-devel
mailing list