summaryrefslogtreecommitdiffstats
path: root/player/client.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-10-24 21:52:16 +0200
committerwm4 <wm4@nowhere>2014-10-24 21:57:02 +0200
commit55e3dab7ebd707a94995696aa1098725f3c35521 (patch)
tree3b0bc9c4bde577869468d4e76e90fcda5c1567a4 /player/client.c
parentb330f16fed152ea401c13b3b453604392aaf6bc5 (diff)
downloadmpv-55e3dab7ebd707a94995696aa1098725f3c35521.tar.bz2
mpv-55e3dab7ebd707a94995696aa1098725f3c35521.tar.xz
command: finish hook execution if client fails
Translation: if the (to be added) youtube-dl Lua script crashes, don't wait forever when opening something.
Diffstat (limited to 'player/client.c')
-rw-r--r--player/client.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/player/client.c b/player/client.c
index a150271df0..8376756a9a 100644
--- a/player/client.c
+++ b/player/client.c
@@ -187,6 +187,14 @@ static struct mpv_handle *find_client(struct mp_client_api *clients,
return NULL;
}
+bool mp_client_exists(struct MPContext *mpctx, const char *client_name)
+{
+ pthread_mutex_lock(&mpctx->clients->lock);
+ bool r = find_client(mpctx->clients, client_name);
+ pthread_mutex_unlock(&mpctx->clients->lock);
+ return r;
+}
+
struct mpv_handle *mp_new_client(struct mp_client_api *clients, const char *name)
{
pthread_mutex_lock(&clients->lock);
@@ -348,7 +356,8 @@ void mpv_detach_destroy(mpv_handle *ctx)
}
talloc_free(ctx);
ctx = NULL;
- // shutdown_clients() sleeps to avoid wasting CPU
+ // shutdown_clients() sleeps to avoid wasting CPU.
+ // mp_hook_test_completion() also relies on this a bit.
if (clients->mpctx->input)
mp_input_wakeup(clients->mpctx->input);
break;