aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-01-04 22:32:00 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-01-04 22:32:00 +0000
commitd243a836ce55dff647f8e744441fbd2c3343cfa1 (patch)
treec69575ed6285f6e503d41aa0cf6c14317d37d3dd
parentwayland: use a low priority FDM hook to flush the wayland socket (diff)
wayland: only call wl_display_prepare_read() if we read any events
That is, only call it if we have POLLIN. If not, then we never read any events and we still hold the read lock and thus we shouldn't try to acquire it again.
-rw-r--r--wayland.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/wayland.c b/wayland.c
index ee304bd3..a4868ee7 100644
--- a/wayland.c
+++ b/wayland.c
@@ -569,11 +569,12 @@ fdm_wayl(struct fdm *fdm, int fd, int events, void *data)
struct wayland *wayl = data;
int event_count = 0;
- if (events & EPOLLIN)
+ if (events & EPOLLIN) {
wl_display_read_events(wayl->display);
- while (wl_display_prepare_read(wayl->display) != 0)
- wl_display_dispatch_pending(wayl->display);
+ while (wl_display_prepare_read(wayl->display) != 0)
+ wl_display_dispatch_pending(wayl->display);
+ }
if (events & EPOLLHUP) {
LOG_WARN("disconnected from Wayland");