1#include <xrpl/beast/core/CurrentThreadName.h>
2#include <xrpl/beast/utility/instrumentation.h>
18#if DEBUG && BOOST_COMP_MSVC
25 struct THREADNAME_INFO
37 ni.szName = name.
data();
38 ni.dwThreadID = GetCurrentThreadId();
42#pragma warning(disable : 6320 6322)
46 0x406d1388, 0,
sizeof(ni) /
sizeof(ULONG_PTR), (ULONG_PTR*)&ni);
48 __except (EXCEPTION_CONTINUE_EXECUTION)
66 pthread_setname_np(name.
data());
83 char boundedName[maxThreadNameLength + 1];
88 static_cast<int>(maxThreadNameLength),
91 pthread_setname_np(pthread_self(), boundedName);
93#ifdef TRUNCATED_THREAD_NAME_LOGS
94 if (name.
size() > maxThreadNameLength)
96 std::cerr <<
"WARNING: Thread name \"" << name <<
"\" (length "
97 << name.
size() <<
") exceeds maximum of "
98 << maxThreadNameLength <<
" characters on Linux.\n";
102 "beast::detail::setCurrentThreadNameImpl : Thread name exceeds "
103 "maximum length for Linux");
127 detail::setCurrentThreadNameImpl(name);
thread_local std::string threadName
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
std::string getCurrentThreadName()
Returns the name of the caller thread.