From: Gunnar Beutner Date: Tue, 3 Sep 2013 13:44:31 +0000 (+0200) Subject: base: Don't set thread name for the first thread. X-Git-Tag: v0.0.3~607 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e05f270459828f105d4b39a016d1710a80230aef;p=icinga2 base: Don't set thread name for the first thread. --- diff --git a/icinga-app/icinga.cpp b/icinga-app/icinga.cpp index b7dca724a..397190abd 100644 --- a/icinga-app/icinga.cpp +++ b/icinga-app/icinga.cpp @@ -166,7 +166,7 @@ int main(int argc, char **argv) #endif /* _WIN32 */ /* Set thread title. */ - Utility::SetThreadName("Main Thread"); + Utility::SetThreadName("Main Thread", false); /* Set command-line arguments. */ Application::SetArgC(argc); diff --git a/lib/base/utility.cpp b/lib/base/utility.cpp index 911c867c6..4ceb16327 100644 --- a/lib/base/utility.cpp +++ b/lib/base/utility.cpp @@ -514,10 +514,13 @@ static void WindowsSetThreadName(const char *name) } #endif /* _WIN32 */ -void Utility::SetThreadName(const String& name) +void Utility::SetThreadName(const String& name, bool os) { m_ThreadName.reset(new String(name)); + if (!os) + return; + #ifdef _WIN32 WindowsSetThreadName(name.CStr()); #endif /* _WIN32 */ diff --git a/lib/base/utility.h b/lib/base/utility.h index 94d882890..fa5439e1c 100644 --- a/lib/base/utility.h +++ b/lib/base/utility.h @@ -92,7 +92,7 @@ public: static String EscapeShellCmd(const String& s); - static void SetThreadName(const String& name); + static void SetThreadName(const String& name, bool os = true); static String GetThreadName(void); private: