mirror of
https://github.com/mpv-player/mpv
synced 2025-01-13 02:16:40 +00:00
input: unlock playloop thread during select
This allows other threads to use mp_input_put_key without blocking if the
playloop is doing the 500ms select call (i.e.: during pause).
Makes Cocoa GUI responsive again (regression since 2d363c3
).
This commit is contained in:
parent
134c3e148c
commit
3e1115569e
@ -1737,12 +1737,14 @@ static void input_wait_read(struct input_ctx *ictx, int time)
|
||||
tv.tv_sec = time / 1000;
|
||||
tv.tv_usec = (time % 1000) * 1000;
|
||||
time_val = &tv;
|
||||
input_unlock(ictx);
|
||||
if (select(max_fd + 1, &fds, NULL, NULL, time_val) < 0) {
|
||||
if (errno != EINTR)
|
||||
mp_tmsg(MSGT_INPUT, MSGL_ERR, "Select error: %s\n",
|
||||
strerror(errno));
|
||||
FD_ZERO(&fds);
|
||||
}
|
||||
input_lock(ictx);
|
||||
for (int i = 0; i < ictx->num_fds; i++) {
|
||||
if (ictx->fds[i].select && !FD_ISSET(ictx->fds[i].fd, &fds))
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user