summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-12-08 11:10:59 -0500
committerJan Ekström <jeebjp@gmail.com>2017-12-08 19:58:36 +0200
commit0f9a690eba9184c8f2c86e4a975612aff49cc9e8 (patch)
tree8f77e47dbcbc273cd23099fdfb49519435808ea1
parent3c62a20f48dc3e625f76acdd76c26bfb888d598e (diff)
downloadmpv-0f9a690eba9184c8f2c86e4a975612aff49cc9e8.tar.bz2
mpv-0f9a690eba9184c8f2c86e4a975612aff49cc9e8.tar.xz
terminal-unix: fix busy looping on Linux
POSIX permits select() to modify the timeout, which can happen on the Linux implementation. This can reset the timeout, which spins this into a tight loop. A timeout isn't necessary in the first place, so just use NULL instead.
-rw-r--r--osdep/terminal-unix.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/osdep/terminal-unix.c b/osdep/terminal-unix.c
index c7309fbf50..c9f3553ff0 100644
--- a/osdep/terminal-unix.c
+++ b/osdep/terminal-unix.c
@@ -389,13 +389,12 @@ static void *terminal_thread(void *ptr)
bool stdin_ok = read_terminal; // if false, we still wait for SIGTERM
fd_set readfds;
int max = death_pipe[0] > tty_in ? death_pipe[0] : tty_in;
- struct timeval timeout = { .tv_sec = 0, .tv_usec = 100000 };
while (1) {
FD_ZERO(&readfds);
FD_SET(death_pipe[0], &readfds);
FD_SET(tty_in, &readfds);
getch2_poll();
- int s = select(max + 1, &readfds, NULL, NULL, &timeout);
+ int s = select(max + 1, &readfds, NULL, NULL, NULL);
if (s == -1) {
break;
} else if (s != 0) {