summaryrefslogtreecommitdiffstats
path: root/player/scripting.c
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-10-22 02:34:42 +0200
committerDudemanguy <random342@airmail.cc>2023-11-05 17:36:17 +0000
commit55ed50ba901e70adda09f1cf8c0de7cf80cabeb3 (patch)
tree2117e03f8d0046f45d21479b67d67a3ce35bca14 /player/scripting.c
parent174df99ffa53f1091589eaa4fa0c16cdd55a9326 (diff)
downloadmpv-55ed50ba901e70adda09f1cf8c0de7cf80cabeb3.tar.bz2
mpv-55ed50ba901e70adda09f1cf8c0de7cf80cabeb3.tar.xz
mp_thread: prefer tracking threads with id
This change essentially removes mp_thread_self() and instead add mp_thread_id to track threads and have ability to query current thread id during runtime. This will be useful for upcoming win32 implementation, where accessing thread handle is different than on pthreads. Greatly reduces complexity. Otherweis locked map of tid <-> handle is required which is completely unnecessary for all mpv use-cases. Note that this is the mp_thread_id, not to confuse with system tid. For example on threads-posix implementation it is simply pthread_t.
Diffstat (limited to 'player/scripting.c')
-rw-r--r--player/scripting.c3
1 files changed, 1 insertions, 2 deletions
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;