diff options
author | Kacper Michajłow <kasper93@gmail.com> | 2023-10-22 20:59:34 +0200 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-10-27 23:18:56 +0000 |
commit | cb829879af8f2c93fd77c47f12c162d4ce580e30 (patch) | |
tree | 8307eb9ab1fa788f6a85bf1b69ceebb3c91bdb35 /osdep/threads.c | |
parent | 65806ac4d13913d23fa64f87e01ff760f2e2b329 (diff) | |
download | mpv-cb829879af8f2c93fd77c47f12c162d4ce580e30.tar.bz2 mpv-cb829879af8f2c93fd77c47f12c162d4ce580e30.tar.xz |
mp_threads: rename threads for consistent naming across all of them
I'd like some names to be more descriptive, but to work with 15 chars
limit we have to make some sacrifice.
Also because of the limit, remove the `mpv/` prefix and prioritize
actuall thread name.
Diffstat (limited to 'osdep/threads.c')
-rw-r--r-- | osdep/threads.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/osdep/threads.c b/osdep/threads.c index 0b96216cc7..1802fea3ce 100644 --- a/osdep/threads.c +++ b/osdep/threads.c @@ -40,17 +40,16 @@ int mpthread_mutex_init_recursive(pthread_mutex_t *mutex) void mpthread_set_name(const char *name) { - char tname[80]; - snprintf(tname, sizeof(tname), "mpv/%s", name); #if HAVE_GLIBC_THREAD_NAME - if (pthread_setname_np(pthread_self(), tname) == ERANGE) { - tname[15] = '\0'; // glibc-checked kernel limit + if (pthread_setname_np(pthread_self(), name) == ERANGE) { + char tname[16] = {0}; // glibc-checked kernel limit + strncpy(tname, name, sizeof(tname) - 1); pthread_setname_np(pthread_self(), tname); } #elif HAVE_WIN32_INTERNAL_PTHREADS || HAVE_BSD_THREAD_NAME - pthread_set_name_np(pthread_self(), tname); + pthread_set_name_np(pthread_self(), name); #elif HAVE_OSX_THREAD_NAME - pthread_setname_np(tname); + pthread_setname_np(name); #endif } |