Merge pull request #1493 from TheMuso/truncate-linux-thread-name

libobs: Truncate thread names on Linux
This commit is contained in:
Jim 2018-09-21 10:06:23 -07:00 committed by GitHub
commit 1d3d24af48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -253,6 +253,12 @@ void os_set_thread_name(const char *name)
#elif defined(__FreeBSD__)
pthread_set_name_np(pthread_self(), name);
#elif defined(__GLIBC__) && !defined(__MINGW32__)
pthread_setname_np(pthread_self(), name);
if (strlen(name) <= 15) {
pthread_setname_np(pthread_self(), name);
} else {
char *thread_name = bstrdup_n(name, 15);
pthread_setname_np(pthread_self(), thread_name);
bfree(thread_name);
}
#endif
}