common: define routines to set thread name on more BSDs
src/common/thread.cpp:123:5: error: use of undeclared identifier 'pthread_setname_np' pthread_setname_np(pthread_self(), szThreadName); ^ 1 error generated.
This commit is contained in:
parent
3925f4ff63
commit
1410bd3bd0
|
@ -8,7 +8,7 @@
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#else
|
#else
|
||||||
#if defined(BSD4_4) || defined(__OpenBSD__)
|
#if defined(__Bitrig__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||||
#include <pthread_np.h>
|
#include <pthread_np.h>
|
||||||
#else
|
#else
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
@ -117,8 +117,10 @@ void SwitchCurrentThread() {
|
||||||
void SetCurrentThreadName(const char* szThreadName) {
|
void SetCurrentThreadName(const char* szThreadName) {
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
pthread_setname_np(szThreadName);
|
pthread_setname_np(szThreadName);
|
||||||
#elif defined(__OpenBSD__)
|
#elif defined(__Bitrig__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||||
pthread_set_name_np(pthread_self(), szThreadName);
|
pthread_set_name_np(pthread_self(), szThreadName);
|
||||||
|
#elif defined(__NetBSD__)
|
||||||
|
pthread_setname_np(pthread_self(), "%s", (void*)szThreadName);
|
||||||
#else
|
#else
|
||||||
pthread_setname_np(pthread_self(), szThreadName);
|
pthread_setname_np(pthread_self(), szThreadName);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue