0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02: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:
Stefano Pigozzi 2013-09-01 22:40:35 +02:00
parent 134c3e148c
commit 3e1115569e

View File

@ -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;