summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
Diffstat (limited to 'player')
-rw-r--r--player/client.c10
-rw-r--r--player/command.c6
-rw-r--r--player/scripting.c3
3 files changed, 9 insertions, 10 deletions
diff --git a/player/client.c b/player/client.c
index f78a4e7210..b35f20a859 100644
--- a/player/client.c
+++ b/player/client.c
@@ -423,9 +423,9 @@ static void abort_async(struct MPContext *mpctx, mpv_handle *ctx,
mp_mutex_unlock(&mpctx->abort_lock);
}
-static void get_thread(void *ptr)
+static void get_thread_id(void *ptr)
{
- *(mp_thread *)ptr = mp_thread_self();
+ *(mp_thread_id *)ptr = mp_thread_current_id();
}
static void mp_destroy_client(mpv_handle *ctx, bool terminate)
@@ -522,8 +522,8 @@ static void mp_destroy_client(mpv_handle *ctx, bool terminate)
mpctx->stop_play = PT_QUIT;
mp_dispatch_unlock(mpctx->dispatch);
- mp_thread playthread;
- mp_dispatch_run(mpctx->dispatch, get_thread, &playthread);
+ mp_thread_id playthread;
+ mp_dispatch_run(mpctx->dispatch, get_thread_id, &playthread);
// Ask the core thread to stop.
mp_mutex_lock(&clients->lock);
@@ -532,7 +532,7 @@ static void mp_destroy_client(mpv_handle *ctx, bool terminate)
mp_wakeup_core(mpctx);
// Blocking wait for all clients and core thread to terminate.
- mp_thread_join(playthread);
+ mp_thread_join_id(playthread);
mp_destroy(mpctx);
}
diff --git a/player/command.c b/player/command.c
index 69eed884e1..9757b185f3 100644
--- a/player/command.c
+++ b/player/command.c
@@ -4848,7 +4848,7 @@ struct cmd_list_ctx {
struct mp_cmd_ctx *parent;
bool current_valid;
- mp_thread current;
+ mp_thread_id current_tid;
bool completed_recursive;
// list of sub commands yet to run
@@ -4862,7 +4862,7 @@ static void on_cmd_list_sub_completion(struct mp_cmd_ctx *cmd)
{
struct cmd_list_ctx *list = cmd->on_completion_priv;
- if (list->current_valid && mp_thread_equal(list->current, mp_thread_self())) {
+ if (list->current_valid && mp_thread_id_equal(list->current_tid, mp_thread_current_id())) {
list->completed_recursive = true;
} else {
continue_cmd_list(list);
@@ -4885,7 +4885,7 @@ static void continue_cmd_list(struct cmd_list_ctx *list)
list->completed_recursive = false;
list->current_valid = true;
- list->current = mp_thread_self();
+ list->current_tid = mp_thread_current_id();
run_command(list->mpctx, sub, NULL, on_cmd_list_sub_completion, list);
diff --git a/player/scripting.c b/player/scripting.c
index 962a5e815f..0b200815f1 100644
--- a/player/scripting.c
+++ b/player/scripting.c
@@ -98,8 +98,6 @@ static void run_script(struct mp_script_args *arg)
static MP_THREAD_VOID script_thread(void *p)
{
- pthread_detach(mp_thread_self());
-
struct mp_script_args *arg = p;
run_script(arg);
@@ -198,6 +196,7 @@ static int64_t mp_load_script(struct MPContext *mpctx, const char *fname)
talloc_free(arg);
return -1;
}
+ mp_thread_detach(thread);
}
return id;