From e05f270459828f105d4b39a016d1710a80230aef Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Tue, 3 Sep 2013 15:44:31 +0200 Subject: [PATCH] base: Don't set thread name for the first thread. --- icinga-app/icinga.cpp | 2 +- lib/base/utility.cpp | 5 ++++- lib/base/utility.h | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) 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: -- 2.40.0