x11/wayland: Fix signal handling while blocking in WaitEventTimeout()

Add a new flag to avoid suppressing EINTR in SDL_IOReady(). Pass the
flag in WaitEventTimeout() to ensure that a SIGINT will wake up
SDL_WaitEvent() without another event coming in.
This commit is contained in:
Cameron Gutman
2021-10-30 19:30:34 -05:00
committed by Sam Lantinga
parent c97c46877f
commit a559864968
5 changed files with 37 additions and 11 deletions

View File

@@ -83,7 +83,7 @@ SDL_IOReady(int fd, int flags, int timeoutMS)
result = select(fd + 1, rfdp, wfdp, NULL, tvp);
#endif /* HAVE_POLL */
} while ( result < 0 && errno == EINTR );
} while ( result < 0 && errno == EINTR && !(flags & SDL_IOR_NO_RETRY));
return result;
}

View File

@@ -28,6 +28,7 @@
#define SDL_IOR_READ 0x1
#define SDL_IOR_WRITE 0x2
#define SDL_IOR_NO_RETRY 0x4
extern int SDL_IOReady(int fd, int flags, int timeoutMS);