mirror of https://github.com/mpv-player/mpv
terminal-unix: stop trying to read when terminal disappears
Avoids 100% CPU usage due to terminal code retrying read(). Seems like this was "forgotten" (or there was somehow the assumption poll() would not signal POLLIN anymore). Fixes #5842.
This commit is contained in:
parent
b2e24f42d5
commit
1112b1ba33
|
@ -395,8 +395,10 @@ static void *terminal_thread(void *ptr)
|
|||
polldev(fds, stdin_ok ? 2 : 1, -1);
|
||||
if (fds[0].revents)
|
||||
break;
|
||||
if (fds[1].revents)
|
||||
getch2(input_ctx);
|
||||
if (fds[1].revents) {
|
||||
if (!getch2(input_ctx))
|
||||
break;
|
||||
}
|
||||
}
|
||||
char c;
|
||||
bool quit = read(death_pipe[0], &c, 1) == 1 && c == 1;
|
||||
|
|
Loading…
Reference in New Issue