diff options
author | Kacper Michajłow <kasper93@gmail.com> | 2023-10-21 04:55:41 +0200 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-11-05 17:36:17 +0000 |
commit | 174df99ffa53f1091589eaa4fa0c16cdd55a9326 (patch) | |
tree | 3a60d45615f18beed98a9b08267c28ed7e05dd5f /osdep/terminal-unix.c | |
parent | 3a8b107f6216b38a151d5ca1e9d4f2727e3418f5 (diff) | |
download | mpv-174df99ffa53f1091589eaa4fa0c16cdd55a9326.tar.bz2 mpv-174df99ffa53f1091589eaa4fa0c16cdd55a9326.tar.xz |
ALL: use new mp_thread abstraction
Diffstat (limited to 'osdep/terminal-unix.c')
-rw-r--r-- | osdep/terminal-unix.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/osdep/terminal-unix.c b/osdep/terminal-unix.c index 43a74e6bdb..d5b8fe36b1 100644 --- a/osdep/terminal-unix.c +++ b/osdep/terminal-unix.c @@ -23,7 +23,6 @@ #include <signal.h> #include <errno.h> #include <sys/ioctl.h> -#include <pthread.h> #include <assert.h> #include <termios.h> @@ -349,7 +348,7 @@ static void getch2_poll(void) do_deactivate_getch2(); } -static pthread_t input_thread; +static mp_thread input_thread; static struct input_ctx *input_ctx; static int death_pipe[2] = {-1, -1}; enum { PIPE_STOP, PIPE_CONT }; @@ -406,9 +405,9 @@ static void quit_request_sighandler(int signum) errno = saved_errno; } -static void *terminal_thread(void *ptr) +static MP_THREAD_VOID terminal_thread(void *ptr) { - mpthread_set_name("terminal/input"); + mp_thread_set_name("terminal/input"); bool stdin_ok = read_terminal; // if false, we still wait for SIGTERM while (1) { getch2_poll(); @@ -461,7 +460,7 @@ static void *terminal_thread(void *ptr) if (cmd) mp_input_queue_cmd(input_ctx, cmd); } - return NULL; + MP_THREAD_RETURN(); } void terminal_setup_getch(struct input_ctx *ictx) @@ -483,7 +482,7 @@ void terminal_setup_getch(struct input_ctx *ictx) input_ctx = ictx; - if (pthread_create(&input_thread, NULL, terminal_thread, NULL)) { + if (mp_thread_create(&input_thread, terminal_thread, NULL)) { input_ctx = NULL; close_sig_pipes(); close_tty(); @@ -511,7 +510,7 @@ void terminal_uninit(void) if (input_ctx) { (void)write(death_pipe[1], &(char){0}, 1); - pthread_join(input_thread, NULL); + mp_thread_join(input_thread); close_sig_pipes(); input_ctx = NULL; } |