Use prctl on Linux to set thread name

This commit is contained in:
Jack Andersen 2018-06-01 14:01:11 -10:00
parent 2352699c65
commit 82f1df9c40
1 changed files with 4 additions and 1 deletions

View File

@ -15,6 +15,9 @@
#include <dlfcn.h>
#include <cxxabi.h>
#include <cstring>
#if __linux__
#include <sys/prctl.h>
#endif
#endif
#include <fcntl.h>
@ -61,7 +64,7 @@ void RegisterThreadName(const char* name)
#if __APPLE__
pthread_setname_np(name);
#elif __linux__
pthread_setname_np(pthread_self(), name);
prctl(PR_SET_NAME, name);
#elif _MSC_VER
struct
{