1#include <xrpl/beast/core/CurrentThreadName.h>
17#if DEBUG && BOOST_COMP_MSVC
24 struct THREADNAME_INFO
36 ni.szName = name.
data();
37 ni.dwThreadID = GetCurrentThreadId();
41#pragma warning(disable : 6320 6322)
45 0x406d1388, 0,
sizeof(ni) /
sizeof(ULONG_PTR), (ULONG_PTR*)&ni);
47 __except (EXCEPTION_CONTINUE_EXECUTION)
65 pthread_setname_np(name.
data());
82 char boundedName[maxThreadNameLength + 1];
87 static_cast<int>(maxThreadNameLength),
90 pthread_setname_np(pthread_self(), boundedName);
92#ifdef TRUNCATED_THREAD_NAME_LOGS
93 if (name.
size() > maxThreadNameLength)
95 std::cerr <<
"WARNING: Thread name \"" << name <<
"\" (length "
96 << name.
size() <<
") exceeds maximum of "
97 << maxThreadNameLength <<
" characters on Linux.\n";
121 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.