FreeBSD thread name support.

This commit is contained in:
David Carlier
2020-02-06 18:58:17 +00:00
parent f464b95afb
commit 5e3881117d

View File

@@ -44,6 +44,11 @@
# include <pthread.h>
#endif
#if defined(__FreeBSD__)
# include <pthread.h>
# include <pthread_np.h>
#endif
namespace VS
{
#if defined(_MSC_VER) && defined(DEBUG)
@@ -81,18 +86,18 @@ namespace VS
{
}
} // setThreadName
#elif defined(__linux__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
static void setThreadName(const char* name)
{
#if __GLIBC__ > 2 || __GLIBC_MINOR__ > 11
pthread_setname_np(pthread_self(), name);
#endif
} // setThreadName
#else
static void setThreadName(const char* name)
{
}
#if defined(__linux__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
#if __GLIBC__ > 2 || __GLIBC_MINOR__ > 11
pthread_setname_np(pthread_self(), name);
#endif
#elif defined(__FreeBSD__)
pthread_set_name_np(pthread_self(), name);
#endif
} // setThreadName
#endif
} // namespace VS