summaryrefslogtreecommitdiffstats
path: root/input/ipc-unix.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 /input/ipc-unix.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 'input/ipc-unix.c')
-rw-r--r--input/ipc-unix.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/input/ipc-unix.c b/input/ipc-unix.c
index 595cf7f029..a416b54e1e 100644
--- a/input/ipc-unix.c
+++ b/input/ipc-unix.c
@@ -92,8 +92,6 @@ static int ipc_write_str(struct client_arg *client, const char *buf)
static MP_THREAD_VOID client_thread(void *p)
{
- pthread_detach(mp_thread_self());
-
// We don't use MSG_NOSIGNAL because the moldy fruit OS doesn't support it.
struct sigaction sa = { .sa_handler = SIG_IGN, .sa_flags = SA_RESTART };
sigfillset(&sa.sa_mask);
@@ -234,6 +232,7 @@ static bool ipc_start_client(struct mp_ipc_ctx *ctx, struct client_arg *client,
mp_thread client_thr;
if (mp_thread_create(&client_thr, client_thread, client))
goto err;
+ mp_thread_detach(client_thr);
return true;