From 3e1115569e789104269a691237b3f563963aba4b Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 1 Sep 2013 22:40:35 +0200 Subject: 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). --- mpvcore/input/input.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mpvcore') 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; -- cgit v1.2.3