mirror of https://github.com/oxen-io/lokinet
Slightly DRY thread-setting code, fix warning
There were warnings from the rc variable being unused; this DRYes it to use the same code as linux (including the failure check on rc).
This commit is contained in:
parent
4065413977
commit
84ad0ab4d3
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue