summaryrefslogtreecommitdiffstats
path: root/player/scripting.c
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-10-21 04:55:41 +0200
committerDudemanguy <random342@airmail.cc>2023-11-05 17:36:17 +0000
commit174df99ffa53f1091589eaa4fa0c16cdd55a9326 (patch)
tree3a60d45615f18beed98a9b08267c28ed7e05dd5f /player/scripting.c
parent3a8b107f6216b38a151d5ca1e9d4f2727e3418f5 (diff)
downloadmpv-174df99ffa53f1091589eaa4fa0c16cdd55a9326.tar.bz2
mpv-174df99ffa53f1091589eaa4fa0c16cdd55a9326.tar.xz
ALL: use new mp_thread abstraction
Diffstat (limited to 'player/scripting.c')
-rw-r--r--player/scripting.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/player/scripting.c b/player/scripting.c
index b7268f9b91..962a5e815f 100644
--- a/player/scripting.c
+++ b/player/scripting.c
@@ -20,7 +20,6 @@
#include <sys/types.h>
#include <dirent.h>
#include <math.h>
-#include <pthread.h>
#include <assert.h>
#include <unistd.h>
@@ -87,7 +86,7 @@ static void run_script(struct mp_script_args *arg)
{
char *name = talloc_asprintf(NULL, "%s/%s", arg->backend->name,
mpv_client_name(arg->client));
- mpthread_set_name(name);
+ mp_thread_set_name(name);
talloc_free(name);
if (arg->backend->load(arg) < 0)
@@ -97,14 +96,14 @@ static void run_script(struct mp_script_args *arg)
talloc_free(arg);
}
-static void *script_thread(void *p)
+static MP_THREAD_VOID script_thread(void *p)
{
- pthread_detach(pthread_self());
+ pthread_detach(mp_thread_self());
struct mp_script_args *arg = p;
run_script(arg);
- return NULL;
+ MP_THREAD_RETURN();
}
static int64_t mp_load_script(struct MPContext *mpctx, const char *fname)
@@ -193,8 +192,8 @@ static int64_t mp_load_script(struct MPContext *mpctx, const char *fname)
if (backend->no_thread) {
run_script(arg);
} else {
- pthread_t thread;
- if (pthread_create(&thread, NULL, script_thread, arg)) {
+ mp_thread thread;
+ if (mp_thread_create(&thread, script_thread, arg)) {
mpv_destroy(arg->client);
talloc_free(arg);
return -1;