mirror of https://github.com/AxioDL/logvisor.git
Use prctl on Linux to set thread name
This commit is contained in:
parent
2352699c65
commit
82f1df9c40
|
@ -15,6 +15,9 @@
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <cxxabi.h>
|
#include <cxxabi.h>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#if __linux__
|
||||||
|
#include <sys/prctl.h>
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
@ -61,7 +64,7 @@ void RegisterThreadName(const char* name)
|
||||||
#if __APPLE__
|
#if __APPLE__
|
||||||
pthread_setname_np(name);
|
pthread_setname_np(name);
|
||||||
#elif __linux__
|
#elif __linux__
|
||||||
pthread_setname_np(pthread_self(), name);
|
prctl(PR_SET_NAME, name);
|
||||||
#elif _MSC_VER
|
#elif _MSC_VER
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue