ThreadName.hpp
Go to the documentation of this file.
1 // @formatter:off
2 //
3 // Balau core C++ library
4 //
5 // Copyright (C) 2008 Bora Software (contact@borasoftware.com)
6 //
7 // Licensed under the Boost Software License - Version 1.0 - August 17th, 2003.
8 // See the LICENSE file for the full license text.
9 //
10 
16 
17 #ifndef COM_BORA_SOFTWARE__BALAU_SYSTEM__THREAD_NAME
18 #define COM_BORA_SOFTWARE__BALAU_SYSTEM__THREAD_NAME
19 
20 #include <mutex>
21 #include <string>
22 #include <unordered_set>
23 
24 namespace Balau::System {
25 
37 class ThreadName {
41  public: static const std::string & getName();
42 
46  public: static void setName(const std::string & name);
47 
49 
50  private: static thread_local std::string threadName;
51 };
52 
53 } // namespace Balau::System
54 
55 #endif // COM_BORA_SOFTWARE__BALAU_SYSTEM__THREAD_NAME
static const std::string & getName()
Get the name of the calling thread.
static void setName(const std::string &name)
Set the name of the calling thread.
A thread-local name.
Definition: ThreadName.hpp:37
System utilities and wrappers.
Definition: HttpServerConfiguration.hpp:30