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
2023-09-07 14:44:36 -04:00
committed by tequ
parent 8fc04d5c1f
commit 429a3599b9
21 changed files with 208 additions and 207 deletions

View File

@@ -18,8 +18,8 @@
//==============================================================================
#include <ripple/basics/Log.h>
#include <ripple/basics/ThreadUtilities.h>
#include <ripple/basics/random.h>
#include <ripple/beast/core/CurrentThreadName.h>
#include <ripple/core/impl/SNTPClock.h>
#include <boost/asio.hpp>
#include <cmath>
@@ -193,7 +193,7 @@ public:
void
doRun()
{
beast::setCurrentThreadName("rippled: SNTPClock");
this_thread::set_name("SNTPClock");
io_service_.run();
}