Introduce replacement for getting and setting thread name: (#4312)

* In namespace ripple, introduces get_name function that takes a
  std:🧵:native_handle_type and returns a std::string.
* In namespace ripple, introduces get_name function that takes a
  std::thread or std::jthread and returns a std::string.
* In namespace ripple::this_thread, introduces get_name function
  that takes no parameters and returns the name of the current
  thread as a std::string.
* In namespace ripple::this_thread, introduces set_name function
  that takes a std::string_view and sets the name of the current
  thread.
* Intended to replace the beast utilities setCurrentThreadName
  and getCurrentThreadName.
This commit is contained in:
Howard Hinnant
2026-02-19 16:07:35 +09:00
committed by tequ
parent 2ab5d729cc
commit dd9b0953b8
21 changed files with 208 additions and 207 deletions

View File

@@ -17,7 +17,7 @@
*/
//==============================================================================
#include <ripple/beast/core/CurrentThreadName.h>
#include <ripple/basics/ThreadUtilities.h>
#include <ripple/core/Job.h>
#include <cassert>
@@ -61,7 +61,7 @@ Job::queue_time() const
void
Job::doJob()
{
beast::setCurrentThreadName("doJob: " + mName);
this_thread::set_name("doJob: " + mName);
m_loadEvent->start();
m_loadEvent->setName(mName);