From 82a3ea6853b88e00e1cb62206313902d9c0a4d68 Mon Sep 17 00:00:00 2001 From: Eyal Lotem Date: Fri, 14 Aug 2015 01:10:57 +0300 Subject: [PATCH] x11_window.c: select may return EINTR, needs to be retried --- src/x11_window.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/x11_window.c b/src/x11_window.c index 62e8a2005..0e8ff5a71 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -62,6 +62,7 @@ typedef struct // void selectDisplayConnection(struct timeval* timeout) { + int rc; fd_set fds; const int fd = ConnectionNumber(_glfw.x11.display); @@ -71,7 +72,9 @@ void selectDisplayConnection(struct timeval* timeout) // select(1) is used instead of an X function like XNextEvent, as the // wait inside those are guarded by the mutex protecting the display // struct, locking out other threads from using X (including GLX) - select(fd + 1, &fds, NULL, NULL, timeout); + do { + rc = select(fd + 1, &fds, NULL, NULL, timeout); + } while (-1 == rc && EINTR == errno); } // Returns whether the window is iconified