|
|
|
@ -23,7 +23,7 @@ namespace llarp
|
|
|
|
|
void
|
|
|
|
|
SetThreadName(const std::string& name)
|
|
|
|
|
{
|
|
|
|
|
#ifdef POSIX
|
|
|
|
|
#if defined(POSIX) || __MINGW32__
|
|
|
|
|
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
|
|
|
|
/* on bsd this function has void return type */
|
|
|
|
|
pthread_set_name_np(pthread_self(), name.c_str());
|
|
|
|
@ -33,7 +33,7 @@ namespace llarp
|
|
|
|
|
// API present upstream since v2.11.3 and imported downstream
|
|
|
|
|
// in CR 8158 <https://www.illumos.org/issues/8158>
|
|
|
|
|
// We only use the native function on Microsoft C++ builds
|
|
|
|
|
#elif defined(__linux__) || defined(__sun)
|
|
|
|
|
#elif defined(__linux__) || defined(__sun) || __MINGW32__
|
|
|
|
|
const int rc = pthread_setname_np(pthread_self(), name.c_str());
|
|
|
|
|
#else
|
|
|
|
|
#error "unsupported platform"
|
|
|
|
@ -46,8 +46,6 @@ namespace llarp
|
|
|
|
|
#endif
|
|
|
|
|
#elif _MSC_VER
|
|
|
|
|
::SetThreadName(::GetCurrentThreadId(), name.c_str());
|
|
|
|
|
#elif __MINGW32__
|
|
|
|
|
const int rc = pthread_setname_np(pthread_self(), name.c_str());
|
|
|
|
|
#else
|
|
|
|
|
LogInfo("Thread name setting not supported on this platform");
|
|
|
|
|
(void)name;
|
|
|
|
|