summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2013-09-01 22:40:35 +0200
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2013-09-01 22:48:09 +0200
commit3e1115569e789104269a691237b3f563963aba4b (patch)
treede52c19ff013cab03191b8087f495848156b6451
parent134c3e148cbe2f21608e6d67431f23c3fcbbda8f (diff)
downloadmpv-3e1115569e789104269a691237b3f563963aba4b.tar.bz2
mpv-3e1115569e789104269a691237b3f563963aba4b.tar.xz
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).
-rw-r--r--mpvcore/input/input.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/mpvcore/input/input.c b/mpvcore/input/input.c
index 41df0af855..36f5ad5ab2 100644
--- a/mpvcore/input/input.c
+++ b/mpvcore/input/input.c
@@ -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;