mirror of
https://github.com/MaskRay/ccls.git
synced 2025-02-21 16:09:40 +00:00
Remove <sys/prctl.h> and set thread name on BSD & __APPLE__
This commit is contained in:
parent
720266e97a
commit
66d4926e41
@ -37,7 +37,6 @@
|
|||||||
#include <sys/sysctl.h> // sysctl
|
#include <sys/sysctl.h> // sysctl
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <sys/prctl.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -266,8 +265,12 @@ bool TryMakeDirectory(const std::string& absolute_path) {
|
|||||||
|
|
||||||
void SetCurrentThreadName(const std::string& thread_name) {
|
void SetCurrentThreadName(const std::string& thread_name) {
|
||||||
loguru::set_thread_name(thread_name.c_str());
|
loguru::set_thread_name(thread_name.c_str());
|
||||||
#ifdef __linux__
|
#if defined(__APPLE__)
|
||||||
prctl(PR_SET_NAME, thread_name.c_str(), 0, 0, 0);
|
pthread_setname_np(thread_name.c_str());
|
||||||
|
#elif defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||||
|
pthread_set_name_np(pthread_self(), thread_name.c_str());
|
||||||
|
#elif defined(__linux__)
|
||||||
|
pthread_setname_np(pthread_self(), thread_name.c_str());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user