summaryrefslogtreecommitdiffstats
path: root/osdep
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-10-20 00:17:11 +0200
committerwm4 <wm4@nowhere>2014-10-20 00:17:11 +0200
commit600221e723e1918a8ecdc26bcf9c966be16a4068 (patch)
tree2ea6e4fa9a91a3f3031cbf1e9d6cc65b83011022 /osdep
parent1aae9925858c9463e166045e01ea591986a93375 (diff)
downloadmpv-600221e723e1918a8ecdc26bcf9c966be16a4068.tar.bz2
mpv-600221e723e1918a8ecdc26bcf9c966be16a4068.tar.xz
osdep: limit thread names to 16 characters
It turns out the glibc people are very clever and return an error if the thread name exceeds the maximum supported kernel length, instead of truncating the name. So everyone has to hardcode the currently allowed Linux kernel name length limit, even if it gets extended later. Also the Lua script filenames could get too long; use the client name instead. Another strange thing is that on Linux, unrelated threads "inherit" the name by the thread they were created. This leads to random thread names, because there's not necessarily a strong relation between these threads (e.g. script command leads to filter recreation -> the filter's threads are tagged with the script's thread name). Unfortunate.
Diffstat (limited to 'osdep')
-rw-r--r--osdep/threads.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/osdep/threads.c b/osdep/threads.c
index c41007b2cb..2a5938cee5 100644
--- a/osdep/threads.c
+++ b/osdep/threads.c
@@ -46,7 +46,7 @@ int mpthread_mutex_init_recursive(pthread_mutex_t *mutex)
void mpthread_set_name(const char *name)
{
- char tname[90];
+ char tname[16];
snprintf(tname, sizeof(tname), "mpv %s", name);
#if HAVE_GLIBC_THREAD_NAME
pthread_setname_np(pthread_self(), tname);