summaryrefslogtreecommitdiffstats
path: root/input/ipc-win.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 /input/ipc-win.c
parent3a8b107f6216b38a151d5ca1e9d4f2727e3418f5 (diff)
downloadmpv-174df99ffa53f1091589eaa4fa0c16cdd55a9326.tar.bz2
mpv-174df99ffa53f1091589eaa4fa0c16cdd55a9326.tar.xz
ALL: use new mp_thread abstraction
Diffstat (limited to 'input/ipc-win.c')
-rw-r--r--input/ipc-win.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/input/ipc-win.c b/input/ipc-win.c
index 42a519ecf0..cf80ccdcac 100644
--- a/input/ipc-win.c
+++ b/input/ipc-win.c
@@ -36,7 +36,7 @@ struct mp_ipc_ctx {
struct mp_client_api *client_api;
const wchar_t *path;
- pthread_t thread;
+ mp_thread thread;
HANDLE death_event;
};
@@ -198,9 +198,9 @@ static void report_read_error(struct client_arg *arg, DWORD error)
}
}
-static void *client_thread(void *p)
+static MP_THREAD_VOID client_thread(void *p)
{
- pthread_detach(pthread_self());
+ pthread_detach(mp_thread_self());
struct client_arg *arg = p;
char buf[4096];
@@ -211,7 +211,7 @@ static void *client_thread(void *p)
DWORD r;
char *tname = talloc_asprintf(NULL, "ipc/%s", arg->client_name);
- mpthread_set_name(tname);
+ mp_thread_set_name(tname);
talloc_free(tname);
arg->write_ol.hEvent = CreateEventW(NULL, TRUE, TRUE, NULL);
@@ -307,7 +307,7 @@ done:
CloseHandle(arg->client_h);
mpv_destroy(arg->client);
talloc_free(arg);
- return NULL;
+ MP_THREAD_RETURN();
}
static void ipc_start_client(struct mp_ipc_ctx *ctx, struct client_arg *client)
@@ -315,8 +315,8 @@ static void ipc_start_client(struct mp_ipc_ctx *ctx, struct client_arg *client)
client->client = mp_new_client(ctx->client_api, client->client_name),
client->log = mp_client_get_log(client->client);
- pthread_t client_thr;
- if (pthread_create(&client_thr, NULL, client_thread, client)) {
+ mp_thread client_thr;
+ if (mp_thread_create(&client_thr, client_thread, client)) {
mpv_destroy(client->client);
CloseHandle(client->client_h);
talloc_free(client);
@@ -341,7 +341,7 @@ bool mp_ipc_start_anon_client(struct mp_ipc_ctx *ctx, struct mpv_handle *h,
return false;
}
-static void *ipc_thread(void *p)
+static MP_THREAD_VOID ipc_thread(void *p)
{
// Use PIPE_TYPE_MESSAGE | PIPE_READMODE_BYTE so message framing is
// maintained for message-mode clients, but byte-mode clients can still
@@ -358,7 +358,7 @@ static void *ipc_thread(void *p)
HANDLE client = INVALID_HANDLE_VALUE;
int client_num = 0;
- mpthread_set_name("ipc/named-pipe");
+ mp_thread_set_name("ipc/named-pipe");
MP_VERBOSE(arg, "Starting IPC master\n");
SECURITY_ATTRIBUTES sa = {
@@ -450,7 +450,7 @@ done:
CloseHandle(server);
if (ol.hEvent)
CloseHandle(ol.hEvent);
- return NULL;
+ MP_THREAD_RETURN();
}
struct mp_ipc_ctx *mp_init_ipc(struct mp_client_api *client_api,
@@ -482,7 +482,7 @@ struct mp_ipc_ctx *mp_init_ipc(struct mp_client_api *client_api,
if (!(arg->death_event = CreateEventW(NULL, TRUE, FALSE, NULL)))
goto out;
- if (pthread_create(&arg->thread, NULL, ipc_thread, arg))
+ if (mp_thread_create(&arg->thread, ipc_thread, arg))
goto out;
talloc_free(opts);
@@ -502,7 +502,7 @@ void mp_uninit_ipc(struct mp_ipc_ctx *arg)
return;
SetEvent(arg->death_event);
- pthread_join(arg->thread, NULL);
+ mp_thread_join(arg->thread);
CloseHandle(arg->death_event);
talloc_free(arg);