From 9c25dced5ad3fca55fb5a57773b8797a58e2ba12 Mon Sep 17 00:00:00 2001 From: bthomee Date: Fri, 9 Jan 2026 10:41:04 -0800 Subject: [PATCH] deploy: fc0072383699cf9718af35a22e46df1bad7799bb --- BasicApp_8cpp_source.html | 2 +- CurrentThreadName_8cpp_source.html | 220 ++++++++++-------- CurrentThreadName_8h_source.html | 51 ++-- Database_8cpp_source.html | 2 +- GRPCServer_8cpp_source.html | 2 +- Job_8cpp_source.html | 2 +- LedgerCleaner_8cpp_source.html | 2 +- LoadManager_8cpp_source.html | 2 +- Main_8cpp_source.html | 2 +- PerfLogImp_8cpp_source.html | 2 +- ResourceManager_8cpp_source.html | 4 +- RocksDBFactory_8cpp_source.html | 2 +- SHAMapStoreImp_8cpp_source.html | 2 +- Workers_8cpp_source.html | 2 +- ...__CurrentThreadName__test_8cpp_source.html | 194 +++++++++------ ...pl_1_1test_1_1CurrentThreadName__test.html | 6 +- namespacebeast.html | 4 +- namespacebeast_1_1detail.html | 2 +- short__read__test_8cpp_source.html | 2 +- 19 files changed, 294 insertions(+), 211 deletions(-) diff --git a/BasicApp_8cpp_source.html b/BasicApp_8cpp_source.html index c2f0a6a238..aeb75b0648 100644 --- a/BasicApp_8cpp_source.html +++ b/BasicApp_8cpp_source.html @@ -120,7 +120,7 @@ $(document).ready(function() { init_codefold(0); });
std::optional< boost::asio::executor_work_guard< boost::asio::io_context::executor_type > > work_
Definition BasicApp.h:16
T emplace_back(T... args)
T emplace(T... args)
-
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
+
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
T reserve(T... args)
T reset(T... args)
diff --git a/CurrentThreadName_8cpp_source.html b/CurrentThreadName_8cpp_source.html index e0bb8c46dc..c5bc565ae8 100644 --- a/CurrentThreadName_8cpp_source.html +++ b/CurrentThreadName_8cpp_source.html @@ -83,122 +83,144 @@ $(document).ready(function() { init_codefold(0); });
1#include <xrpl/beast/core/CurrentThreadName.h>
2
-
3#include <boost/predef.h>
-
4
-
5#include <string>
-
6#include <string_view>
+
3#include <string>
+
4#include <string_view>
+
5
+
6//------------------------------------------------------------------------------
7
-
8//------------------------------------------------------------------------------
-
9
-
10#if BOOST_OS_WINDOWS
-
11#include <process.h>
-
12#include <windows.h>
+
8#if BOOST_OS_WINDOWS
+
9#include <process.h>
+
10#include <windows.h>
+
11
+
12namespace beast::detail {
13
-
14namespace beast::detail {
-
15
-
16inline void
-
17setCurrentThreadNameImpl(std::string_view name)
-
18{
-
19#if DEBUG && BOOST_COMP_MSVC
-
20 // This technique is documented by Microsoft and works for all versions
-
21 // of Windows and Visual Studio provided that the process is being run
-
22 // under the Visual Studio debugger. For more details, see:
-
23 // https://docs.microsoft.com/en-us/visualstudio/debugger/how-to-set-a-thread-name-in-native-code
-
24
-
25#pragma pack(push, 8)
-
26 struct THREADNAME_INFO
-
27 {
-
28 DWORD dwType;
-
29 LPCSTR szName;
-
30 DWORD dwThreadID;
-
31 DWORD dwFlags;
-
32 };
-
33#pragma pack(pop)
+
14inline void
+
15setCurrentThreadNameImpl(std::string_view name)
+
16{
+
17#if DEBUG && BOOST_COMP_MSVC
+
18 // This technique is documented by Microsoft and works for all versions
+
19 // of Windows and Visual Studio provided that the process is being run
+
20 // under the Visual Studio debugger. For more details, see:
+
21 // https://docs.microsoft.com/en-us/visualstudio/debugger/how-to-set-a-thread-name-in-native-code
+
22
+
23#pragma pack(push, 8)
+
24 struct THREADNAME_INFO
+
25 {
+
26 DWORD dwType;
+
27 LPCSTR szName;
+
28 DWORD dwThreadID;
+
29 DWORD dwFlags;
+
30 };
+
31#pragma pack(pop)
+
32
+
33 THREADNAME_INFO ni;
34
-
35 THREADNAME_INFO ni;
-
36
-
37 ni.dwType = 0x1000;
-
38 ni.szName = name.data();
-
39 ni.dwThreadID = GetCurrentThreadId();
-
40 ni.dwFlags = 0;
-
41
-
42#pragma warning(push)
-
43#pragma warning(disable : 6320 6322)
-
44 __try
-
45 {
-
46 RaiseException(
-
47 0x406d1388, 0, sizeof(ni) / sizeof(ULONG_PTR), (ULONG_PTR*)&ni);
-
48 }
-
49 __except (EXCEPTION_CONTINUE_EXECUTION)
-
50 {
-
51 }
-
52#pragma warning(pop)
-
53#endif
-
54}
-
55
-
56} // namespace beast::detail
-
57#endif // BOOST_OS_WINDOWS
-
58
-
59#if BOOST_OS_MACOS
-
60#include <pthread.h>
+
35 ni.dwType = 0x1000;
+
36 ni.szName = name.data();
+
37 ni.dwThreadID = GetCurrentThreadId();
+
38 ni.dwFlags = 0;
+
39
+
40#pragma warning(push)
+
41#pragma warning(disable : 6320 6322)
+
42 __try
+
43 {
+
44 RaiseException(
+
45 0x406d1388, 0, sizeof(ni) / sizeof(ULONG_PTR), (ULONG_PTR*)&ni);
+
46 }
+
47 __except (EXCEPTION_CONTINUE_EXECUTION)
+
48 {
+
49 }
+
50#pragma warning(pop)
+
51#endif
+
52}
+
53
+
54} // namespace beast::detail
+
55#endif // BOOST_OS_WINDOWS
+
56
+
57#if BOOST_OS_MACOS
+
58#include <pthread.h>
+
59
+
60namespace beast::detail {
61
-
62namespace beast::detail {
-
63
-
64inline void
-
65setCurrentThreadNameImpl(std::string_view name)
-
66{
-
67 pthread_setname_np(name.data());
-
68}
-
69
-
70} // namespace beast::detail
-
71#endif // BOOST_OS_MACOS
-
72
-
73#if BOOST_OS_LINUX
-
74#include <pthread.h>
+
62inline void
+
63setCurrentThreadNameImpl(std::string_view name)
+
64{
+
65 pthread_setname_np(name.data());
+
66}
+
67
+
68} // namespace beast::detail
+
69#endif // BOOST_OS_MACOS
+
70
+
71#if BOOST_OS_LINUX
+
72#include <pthread.h>
+
73
+
74#include <iostream>
75
76namespace beast::detail {
77
78inline void
79setCurrentThreadNameImpl(std::string_view name)
80{
-
81 pthread_setname_np(pthread_self(), name.data());
-
82}
-
83
-
84} // namespace beast::detail
-
85#endif // BOOST_OS_LINUX
-
86
-
87namespace beast {
-
88
-
89namespace detail {
- -
91} // namespace detail
-
92
- -
- -
95{
-
96 return detail::threadName;
-
97}
+
81 // truncate and set the thread name.
+
82 char boundedName[maxThreadNameLength + 1];
+ +
84 boundedName,
+
85 sizeof(boundedName),
+
86 "%.*s",
+
87 static_cast<int>(maxThreadNameLength),
+
88 name.data());
+
89
+
90 pthread_setname_np(pthread_self(), boundedName);
+
91
+
92#ifdef TRUNCATED_THREAD_NAME_LOGS
+
93 if (name.size() > maxThreadNameLength)
+
94 {
+
95 std::cerr << "WARNING: Thread name \"" << name << "\" (length "
+
96 << name.size() << ") exceeds maximum of "
+
97 << maxThreadNameLength << " characters on Linux.\n";
+
98 }
+
99#endif
+
100}
+
101
+
102} // namespace beast::detail
+
103#endif // BOOST_OS_LINUX
+
104
+
105namespace beast {
+
106
+
107namespace detail {
+ +
109} // namespace detail
+
110
+ +
+ +
113{
+
114 return detail::threadName;
+
115}
-
98
-
99void
-
- -
101{
-
102 detail::threadName = name;
-
103 detail::setCurrentThreadNameImpl(name);
-
104}
+
116
+
117void
+
+ +
119{
+
120 detail::threadName = name;
+
121 detail::setCurrentThreadNameImpl(name);
+
122}
-
105
-
106} // namespace beast
+
123
+
124} // namespace beast
+
T data(T... args)
+
T snprintf(T... args)
+ -
thread_local std::string threadName
+
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.
+
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
+
std::string getCurrentThreadName()
Returns the name of the caller thread.
+
T size(T... args)
diff --git a/CurrentThreadName_8h_source.html b/CurrentThreadName_8h_source.html index 5b1a0f6e98..d7a47a5704 100644 --- a/CurrentThreadName_8h_source.html +++ b/CurrentThreadName_8h_source.html @@ -88,25 +88,46 @@ $(document).ready(function() { init_codefold(0); });
5#ifndef BEAST_CORE_CURRENT_THREAD_NAME_H_INCLUDED
6#define BEAST_CORE_CURRENT_THREAD_NAME_H_INCLUDED
7
-
8#include <string>
-
9#include <string_view>
-
10
-
11namespace beast {
+
8#include <boost/predef.h>
+
9
+
10#include <string>
+
11#include <string_view>
12
-
16void
- -
18
- - -
29
-
30} // namespace beast
-
31
-
32#endif
+
13namespace beast {
+
14
+
18void
+ +
20
+
21#if BOOST_OS_LINUX
+
22
+
23// On Linux, thread names are limited to 16 bytes including the null terminator.
+
24// Maximum number of characters is therefore 15.
+
25constexpr std::size_t maxThreadNameLength = 15;
+
26
+
34template <std::size_t N>
+
35void
+
36setCurrentThreadName(char const (&newThreadName)[N])
+
37{
+
38 static_assert(
+
39 N <= maxThreadNameLength + 1,
+
40 "Thread name cannot exceed 15 characters");
+
41
+
42 setCurrentThreadName(std::string_view(newThreadName, N - 1));
+
43}
+
44#endif
+
45
+ + +
56
+
57} // namespace beast
+
58
+
59#endif
-
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
-
std::string getCurrentThreadName()
Returns the name of the caller thread.
+
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
+
std::string getCurrentThreadName()
Returns the name of the caller thread.
+
diff --git a/Database_8cpp_source.html b/Database_8cpp_source.html index ac67032ddc..24c9d7d582 100644 --- a/Database_8cpp_source.html +++ b/Database_8cpp_source.html @@ -419,7 +419,7 @@ $(document).ready(function() { init_codefold(0); });
T load(T... args)
unsigned int UInt
-
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
+
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
STL namespace.
void read(nudb::detail::istream &is, std::size_t &u)
Definition varint.h:102
diff --git a/GRPCServer_8cpp_source.html b/GRPCServer_8cpp_source.html index 1957b598c4..7fc34efd40 100644 --- a/GRPCServer_8cpp_source.html +++ b/GRPCServer_8cpp_source.html @@ -822,7 +822,7 @@ $(document).ready(function() { init_codefold(0); });
T join(T... args)
boost::asio::ip::tcp::endpoint to_asio_endpoint(Endpoint const &endpoint)
Convert to asio::ip::tcp::endpoint.
Endpoint from_asio(boost::asio::ip::address const &address)
Convert to Endpoint.
-
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
+
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
STL namespace.
Condition
Definition Handler.h:20
@ NO_CONDITION
Definition Handler.h:21
diff --git a/Job_8cpp_source.html b/Job_8cpp_source.html index 4bfc390ed3..53788aabb5 100644 --- a/Job_8cpp_source.html +++ b/Job_8cpp_source.html @@ -224,7 +224,7 @@ $(document).ready(function() { init_codefold(0); });
T is_same_v
-
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
+
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
JobType
Definition Job.h:15
@ jtINVALID
Definition Job.h:17
diff --git a/LedgerCleaner_8cpp_source.html b/LedgerCleaner_8cpp_source.html index 8f65c1876d..55bec17460 100644 --- a/LedgerCleaner_8cpp_source.html +++ b/LedgerCleaner_8cpp_source.html @@ -600,7 +600,7 @@ $(document).ready(function() { init_codefold(0); });
T joinable(T... args)
-
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
+
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
std::unique_ptr< LedgerCleaner > make_LedgerCleaner(Application &app, beast::Journal journal)
diff --git a/LoadManager_8cpp_source.html b/LoadManager_8cpp_source.html index a035dcb525..ab60259836 100644 --- a/LoadManager_8cpp_source.html +++ b/LoadManager_8cpp_source.html @@ -317,7 +317,7 @@ $(document).ready(function() { init_codefold(0); });
-
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
+
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
diff --git a/Main_8cpp_source.html b/Main_8cpp_source.html index 58a15ef58a..47cffaaaed 100644 --- a/Main_8cpp_source.html +++ b/Main_8cpp_source.html @@ -986,7 +986,7 @@ $(document).ready(function() { init_codefold(0); });
Severity
Severity level / threshold of a Journal message.
Definition Journal.h:13
@ kTrace
Definition Journal.h:16
-
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
+
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
STL namespace.
std::string const & getVersionString()
Server version.
Definition BuildInfo.cpp:49
int fromCommandLine(Config const &config, std::vector< std::string > const &vCmd, Logs &logs)
Definition RPCCall.cpp:1642
diff --git a/PerfLogImp_8cpp_source.html b/PerfLogImp_8cpp_source.html index 420b06aab7..dcf898155d 100644 --- a/PerfLogImp_8cpp_source.html +++ b/PerfLogImp_8cpp_source.html @@ -691,7 +691,7 @@ $(document).ready(function() { init_codefold(0); });
@ arrayValue
array value (ordered list)
Definition json_value.h:26
@ objectValue
object value (collection of name/value pairs).
Definition json_value.h:27
-
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
+
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
STL namespace.
std::unique_ptr< PerfLog > make_PerfLog(PerfLog::Setup const &setup, Application &app, beast::Journal journal, std::function< void()> &&signalStop)
PerfLog::Setup setup_PerfLog(Section const &section, boost::filesystem::path const &configDir)
diff --git a/ResourceManager_8cpp_source.html b/ResourceManager_8cpp_source.html index 18ad7faa46..89c16de6bc 100644 --- a/ResourceManager_8cpp_source.html +++ b/ResourceManager_8cpp_source.html @@ -247,7 +247,7 @@ $(document).ready(function() { init_codefold(0); });
142 {
-
143 beast::setCurrentThreadName("Resource::Manager");
+
143 beast::setCurrentThreadName("Resource::Mngr");
144 for (;;)
145 {
@@ -337,7 +337,7 @@ $(document).ready(function() { init_codefold(0); }); -
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
+
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
std::unique_ptr< Manager > make_Manager(beast::insight::Collector::ptr const &collector, beast::Journal journal)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
Stopwatch & stopwatch()
Returns an instance of a wall clock.
Definition chrono.h:100
diff --git a/RocksDBFactory_8cpp_source.html b/RocksDBFactory_8cpp_source.html index 1e42a56225..d904dd9362 100644 --- a/RocksDBFactory_8cpp_source.html +++ b/RocksDBFactory_8cpp_source.html @@ -572,7 +572,7 @@ $(document).ready(function() { init_codefold(0); });
T is_same_v
-
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
+
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
Status
Return codes from Backend operations.
diff --git a/SHAMapStoreImp_8cpp_source.html b/SHAMapStoreImp_8cpp_source.html index f8b2f38e98..3731abb3f2 100644 --- a/SHAMapStoreImp_8cpp_source.html +++ b/SHAMapStoreImp_8cpp_source.html @@ -923,7 +923,7 @@ $(document).ready(function() { init_codefold(0); });
T max(T... args)
T min(T... args)
-
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
+
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
STL namespace.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
diff --git a/Workers_8cpp_source.html b/Workers_8cpp_source.html index f52374f301..b25819067f 100644 --- a/Workers_8cpp_source.html +++ b/Workers_8cpp_source.html @@ -403,7 +403,7 @@ $(document).ready(function() { init_codefold(0); });
T join(T... args)
T load(T... args)
-
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
+
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
Called to perform tasks as needed.
Definition Workers.h:66
diff --git a/beast__CurrentThreadName__test_8cpp_source.html b/beast__CurrentThreadName__test_8cpp_source.html index bfd870bc55..c2bf762c87 100644 --- a/beast__CurrentThreadName__test_8cpp_source.html +++ b/beast__CurrentThreadName__test_8cpp_source.html @@ -84,92 +84,132 @@ $(document).ready(function() { init_codefold(0); });
1#include <xrpl/beast/core/CurrentThreadName.h>
2#include <xrpl/beast/unit_test.h>
3
-
4#include <thread>
+
4#include <boost/predef/os.h>
5
-
6namespace xrpl {
-
7namespace test {
-
8
-
- -
10{
-
11private:
-
12 static void
-
- -
14 std::string myName,
- -
16 std::atomic<int>* state)
-
17 {
-
18 // Verify that upon creation a thread has no name.
-
19 auto const initialThreadName = beast::getCurrentThreadName();
-
20
-
21 // Set the new name.
- -
23
-
24 // Indicate to caller that the name is set.
-
25 *state = 1;
-
26
-
27 // If there is an initial thread name then we failed.
-
28 if (!initialThreadName.empty())
-
29 return;
-
30
-
31 // Wait until all threads have their names.
-
32 while (!*stop)
-
33 ;
-
34
-
35 // Make sure the thread name that we set before is still there
-
36 // (not overwritten by, for instance, another thread).
-
37 if (beast::getCurrentThreadName() == myName)
-
38 *state = 2;
-
39 }
+
6#include <thread>
+
7
+
8namespace xrpl {
+
9namespace test {
+
10
+
+ +
12{
+
13private:
+
14 static void
+
+ +
16 std::string myName,
+ +
18 std::atomic<int>* state)
+
19 {
+
20 // Verify that upon creation a thread has no name.
+
21 auto const initialThreadName = beast::getCurrentThreadName();
+
22
+
23 // Set the new name.
+ +
25
+
26 // Indicate to caller that the name is set.
+
27 *state = 1;
+
28
+
29 // If there is an initial thread name then we failed.
+
30 if (!initialThreadName.empty())
+
31 return;
+
32
+
33 // Wait until all threads have their names.
+
34 while (!*stop)
+
35 ;
+
36
+
37 // Make sure the thread name that we set before is still there
+
38 // (not overwritten by, for instance, another thread).
+
39 if (beast::getCurrentThreadName() == myName)
+
40 *state = 2;
+
41 }
-
40
-
41public:
-
42 void
-
-
43 run() override
-
44 {
-
45 // Make two different threads with two different names. Make sure
-
46 // that the expected thread names are still there when the thread
-
47 // exits.
-
48 std::atomic<bool> stop{false};
-
49
-
50 std::atomic<int> stateA{0};
-
51 std::thread tA(exerciseName, "tA", &stop, &stateA);
-
52
-
53 std::atomic<int> stateB{0};
-
54 std::thread tB(exerciseName, "tB", &stop, &stateB);
+
42#if BOOST_OS_LINUX
+
43 // Helper function to test a specific name.
+
44 // It creates a thread, sets the name, and checks if the OS-level
+
45 // name matches the expected (potentially truncated) name.
+
46 void
+
47 testName(std::string const& nameToSet, std::string const& expectedName)
+
48 {
+
49 std::thread t([&] {
+ +
51
+
52 // Initialize buffer to be safe.
+
53 char actualName[beast::maxThreadNameLength + 1] = {};
+
54 pthread_getname_np(pthread_self(), actualName, sizeof(actualName));
55
-
56 // Wait until both threads have set their names.
-
57 while (stateA == 0 || stateB == 0)
-
58 ;
-
59
-
60 stop = true;
-
61 tA.join();
-
62 tB.join();
-
63
-
64 // Both threads should still have the expected name when they exit.
-
65 BEAST_EXPECT(stateA == 2);
-
66 BEAST_EXPECT(stateB == 2);
-
67 }
-
-
68};
-
-
69
-
70BEAST_DEFINE_TESTSUITE(CurrentThreadName, beast, beast);
+
56 BEAST_EXPECT(std::string(actualName) == expectedName);
+
57 });
+
58 t.join();
+
59 }
+
60#endif
+
61
+
62public:
+
63 void
+
+
64 run() override
+
65 {
+
66 // Make two different threads with two different names.
+
67 // Make sure that the expected thread names are still there
+
68 // when the thread exits.
+
69 {
+
70 std::atomic<bool> stop{false};
71
-
72} // namespace test
-
73} // namespace xrpl
+
72 std::atomic<int> stateA{0};
+
73 std::thread tA(exerciseName, "tA", &stop, &stateA);
+
74
+
75 std::atomic<int> stateB{0};
+
76 std::thread tB(exerciseName, "tB", &stop, &stateB);
+
77
+
78 // Wait until both threads have set their names.
+
79 while (stateA == 0 || stateB == 0)
+
80 ;
+
81
+
82 stop = true;
+
83 tA.join();
+
84 tB.join();
+
85
+
86 // Both threads should still have the expected name when they exit.
+
87 BEAST_EXPECT(stateA == 2);
+
88 BEAST_EXPECT(stateB == 2);
+
89 }
+
90#if BOOST_OS_LINUX
+
91 // On Linux, verify that thread names longer than 15 characters
+
92 // are truncated to 15 characters (the 16th character is reserved for
+
93 // the null terminator).
+
94 {
+
95 testName(
+
96 "123456789012345",
+
97 "123456789012345"); // 15 chars, no truncation
+
98 testName(
+
99 "1234567890123456", "123456789012345"); // 16 chars, truncated
+
100 testName(
+
101 "ThisIsAVeryLongThreadNameExceedingLimit",
+
102 "ThisIsAVeryLong"); // 39 chars, truncated
+
103 testName("", ""); // empty name
+
104 testName("short", "short"); // short name, no truncation
+
105 }
+
106#endif
+
107 }
+
+
108};
+
+
109
+
110BEAST_DEFINE_TESTSUITE(CurrentThreadName, beast, beast);
+
111
+
112} // namespace test
+
113} // namespace xrpl
A testsuite class.
Definition suite.h:52
- -
static void exerciseName(std::string myName, std::atomic< bool > *stop, std::atomic< int > *state)
- + +
static void exerciseName(std::string myName, std::atomic< bool > *stop, std::atomic< int > *state)
+
T join(T... args)
-
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
-
std::string getCurrentThreadName()
Returns the name of the caller thread.
+
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
+
std::string getCurrentThreadName()
Returns the name of the caller thread.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
diff --git a/classxrpl_1_1test_1_1CurrentThreadName__test.html b/classxrpl_1_1test_1_1CurrentThreadName__test.html index efb40d9e1d..0e31db89d8 100644 --- a/classxrpl_1_1test_1_1CurrentThreadName__test.html +++ b/classxrpl_1_1test_1_1CurrentThreadName__test.html @@ -242,7 +242,7 @@ Private Attributes

Detailed Description

-

Definition at line 9 of file beast_CurrentThreadName_test.cpp.

+

Definition at line 11 of file beast_CurrentThreadName_test.cpp.

Member Function Documentation

◆ exerciseName()

@@ -284,7 +284,7 @@ Private Attributes
-

Definition at line 13 of file beast_CurrentThreadName_test.cpp.

+

Definition at line 15 of file beast_CurrentThreadName_test.cpp.

@@ -315,7 +315,7 @@ Private Attributes

Implements beast::unit_test::suite.

-

Definition at line 43 of file beast_CurrentThreadName_test.cpp.

+

Definition at line 64 of file beast_CurrentThreadName_test.cpp.

diff --git a/namespacebeast.html b/namespacebeast.html index b40bfae8d0..2d9716fc60 100644 --- a/namespacebeast.html +++ b/namespacebeast.html @@ -987,7 +987,7 @@ template<bool IsMulti, bool IsMap, class Key , class T , class Clock , class

Changes the name of the caller thread.

Different OSes may place different length or content limits on this name.

-

Definition at line 100 of file CurrentThreadName.cpp.

+

Definition at line 118 of file CurrentThreadName.cpp.

@@ -1010,7 +1010,7 @@ template<bool IsMulti, bool IsMap, class Key , class T , class Clock , class

The name returned is the name as set by a call to setCurrentThreadName(). If the thread name is set by an external force, then that name change will not be reported.

If no name has ever been set, then the empty string is returned.

-

Definition at line 94 of file CurrentThreadName.cpp.

+

Definition at line 112 of file CurrentThreadName.cpp.

diff --git a/namespacebeast_1_1detail.html b/namespacebeast_1_1detail.html index 0275bcccd3..8dc9b90371 100644 --- a/namespacebeast_1_1detail.html +++ b/namespacebeast_1_1detail.html @@ -440,7 +440,7 @@ template<typename T >
-

Definition at line 90 of file CurrentThreadName.cpp.

+

Definition at line 108 of file CurrentThreadName.cpp.

diff --git a/short__read__test_8cpp_source.html b/short__read__test_8cpp_source.html index 7c0ca6402c..710187543b 100644 --- a/short__read__test_8cpp_source.html +++ b/short__read__test_8cpp_source.html @@ -881,7 +881,7 @@ $(document).ready(function() { init_codefold(0); });
-
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
+
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
Definition IPAddress.h:86
STL namespace.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6