Skip to content

Commit

Permalink
Revert ThreadName due to problems on Windows (#4702)
Browse files Browse the repository at this point in the history
* Revert "Remove CurrentThreadName.h from RippledCore.cmake (#4697)"

This reverts commit 3b5fcd5.

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

This reverts commit 36cb5f9.
  • Loading branch information
HowardHinnant authored Sep 14, 2023
1 parent 649c11a commit ce570c1
Show file tree
Hide file tree
Showing 21 changed files with 205 additions and 205 deletions.
6 changes: 3 additions & 3 deletions Builds/CMake/RippledCore.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ add_library(xrpl::libxrpl ALIAS libxrpl)
#]===============================]
target_sources (xrpl_core PRIVATE
src/ripple/beast/clock/basic_seconds_clock.cpp
src/ripple/beast/core/CurrentThreadName.cpp
src/ripple/beast/core/SemanticVersion.cpp
src/ripple/beast/hash/impl/xxhash.cpp
src/ripple/beast/insight/impl/Collector.cpp
Expand Down Expand Up @@ -55,7 +56,6 @@ target_sources (xrpl_core PRIVATE
src/ripple/basics/impl/Log.cpp
src/ripple/basics/impl/Number.cpp
src/ripple/basics/impl/StringUtilities.cpp
src/ripple/basics/impl/ThreadUtilities.cpp
#[===============================[
main sources:
subdir: json
Expand Down Expand Up @@ -203,7 +203,6 @@ install (
src/ripple/basics/tagged_integer.h
src/ripple/basics/SubmitSync.h
src/ripple/basics/ThreadSafetyAnalysis.h
src/ripple/basics/ThreadUtilities.h
src/ripple/basics/ToString.h
src/ripple/basics/UnorderedContainers.h
src/ripple/basics/UptimeClock.h
Expand Down Expand Up @@ -315,6 +314,7 @@ install (
DESTINATION include/ripple/beast/clock)
install (
FILES
src/ripple/beast/core/CurrentThreadName.h
src/ripple/beast/core/LexicalCast.h
src/ripple/beast/core/List.h
src/ripple/beast/core/SemanticVersion.h
Expand Down Expand Up @@ -846,7 +846,6 @@ if (tests)
src/test/basics/Slice_test.cpp
src/test/basics/StringUtilities_test.cpp
src/test/basics/TaggedCache_test.cpp
src/test/basics/ThreadName_test.cpp
src/test/basics/XRPAmount_test.cpp
src/test/basics/base64_test.cpp
src/test/basics/base_uint_test.cpp
Expand All @@ -864,6 +863,7 @@ if (tests)
src/test/beast/LexicalCast_test.cpp
src/test/beast/SemanticVersion_test.cpp
src/test/beast/aged_associative_container_test.cpp
src/test/beast/beast_CurrentThreadName_test.cpp
src/test/beast/beast_Journal_test.cpp
src/test/beast/beast_PropertyStream_test.cpp
src/test/beast/beast_Zero_test.cpp
Expand Down
4 changes: 2 additions & 2 deletions src/ripple/app/ledger/impl/LedgerCleaner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <ripple/app/ledger/LedgerCleaner.h>
#include <ripple/app/ledger/LedgerMaster.h>
#include <ripple/app/misc/LoadFeeTrack.h>
#include <ripple/basics/ThreadUtilities.h>
#include <ripple/beast/core/CurrentThreadName.h>
#include <ripple/protocol/jss.h>

namespace ripple {
Expand Down Expand Up @@ -218,7 +218,7 @@ class LedgerCleanerImp : public LedgerCleaner
void
run()
{
this_thread::set_name("LedgerCleaner");
beast::setCurrentThreadName("LedgerCleaner");
JLOG(j_.debug()) << "Started";

while (true)
Expand Down
4 changes: 2 additions & 2 deletions src/ripple/app/main/BasicApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
//==============================================================================

#include <ripple/app/main/BasicApp.h>
#include <ripple/basics/ThreadUtilities.h>
#include <ripple/beast/core/CurrentThreadName.h>

BasicApp::BasicApp(std::size_t numberOfThreads)
{
Expand All @@ -28,7 +28,7 @@ BasicApp::BasicApp(std::size_t numberOfThreads)
while (numberOfThreads--)
{
threads_.emplace_back([this, numberOfThreads]() {
ripple::this_thread::set_name(
beast::setCurrentThreadName(
"io svc #" + std::to_string(numberOfThreads));
this->io_service_.run();
});
Expand Down
5 changes: 3 additions & 2 deletions src/ripple/app/main/GRPCServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include <ripple/app/main/GRPCServer.h>
#include <ripple/app/reporting/P2pProxy.h>
#include <ripple/basics/ThreadUtilities.h>
#include <ripple/beast/core/CurrentThreadName.h>
#include <ripple/resource/Fees.h>

#include <ripple/beast/net/IPAddressConversion.h>
Expand Down Expand Up @@ -692,8 +692,9 @@ GRPCServer::start()
if (running_ = impl_.start(); running_)
{
thread_ = std::thread([this]() {
beast::setCurrentThreadName("rippled : GRPCServer");
// Start the event loop and begin handling requests
this_thread::set_name("rippled: grpc");
beast::setCurrentThreadName("rippled: grpc");
this->impl_.handleRpcs();
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/ripple/app/main/LoadManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
#include <ripple/app/main/LoadManager.h>
#include <ripple/app/misc/LoadFeeTrack.h>
#include <ripple/app/misc/NetworkOPs.h>
#include <ripple/basics/ThreadUtilities.h>
#include <ripple/basics/UptimeClock.h>
#include <ripple/beast/core/CurrentThreadName.h>
#include <ripple/json/to_string.h>
#include <memory>
#include <mutex>
Expand Down Expand Up @@ -99,7 +99,7 @@ LoadManager::stop()
void
LoadManager::run()
{
this_thread::set_name("LoadManager");
beast::setCurrentThreadName("LoadManager");

using namespace std::chrono_literals;
using clock_type = std::chrono::steady_clock;
Expand Down
7 changes: 4 additions & 3 deletions src/ripple/app/main/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
#include <ripple/app/rdb/Vacuum.h>
#include <ripple/basics/Log.h>
#include <ripple/basics/StringUtilities.h>
#include <ripple/basics/ThreadUtilities.h>
#include <ripple/basics/contract.h>
#include <ripple/beast/clock/basic_seconds_clock.h>
#include <ripple/beast/core/CurrentThreadName.h>
#include <ripple/core/Config.h>
#include <ripple/core/ConfigSections.h>
#include <ripple/core/TimeKeeper.h>
Expand Down Expand Up @@ -348,7 +348,8 @@ run(int argc, char** argv)
{
using namespace std;

this_thread::set_name("main " + BuildInfo::getVersionString());
beast::setCurrentThreadName(
"rippled: main " + BuildInfo::getVersionString());

po::variables_map vm;

Expand Down Expand Up @@ -826,7 +827,7 @@ run(int argc, char** argv)
}

// We have an RPC command to process:
this_thread::set_name("rippled: rpc");
beast::setCurrentThreadName("rippled: rpc");
return RPCCall::fromCommandLine(
*config, vm["parameters"].as<std::vector<std::string>>(), *logs);
}
Expand Down
4 changes: 2 additions & 2 deletions src/ripple/app/misc/SHAMapStoreImp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <ripple/app/misc/NetworkOPs.h>
#include <ripple/app/rdb/State.h>
#include <ripple/app/rdb/backend/SQLiteDatabase.h>
#include <ripple/basics/ThreadUtilities.h>
#include <ripple/beast/core/CurrentThreadName.h>
#include <ripple/core/ConfigSections.h>
#include <ripple/core/Pg.h>
#include <ripple/nodestore/Scheduler.h>
Expand Down Expand Up @@ -286,7 +286,7 @@ SHAMapStoreImp::run()
"Reporting does not support online_delete. Remove "
"online_delete info from config");
}
this_thread::set_name("SHAMapStore");
beast::setCurrentThreadName("SHAMapStore");
LedgerIndex lastRotated = state_db_.getState().lastRotated;
netOPs_ = &app_.getOPs();
ledgerMaster_ = &app_.getLedgerMaster();
Expand Down
1 change: 1 addition & 0 deletions src/ripple/app/reporting/ETLSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include <ripple/app/reporting/ETLSource.h>
#include <ripple/app/reporting/ReportingETL.h>
#include <ripple/beast/core/CurrentThreadName.h>
#include <ripple/json/json_reader.h>
#include <ripple/json/json_writer.h>

Expand Down
11 changes: 6 additions & 5 deletions src/ripple/app/reporting/ReportingETL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@

#include <ripple/app/rdb/backend/PostgresDatabase.h>
#include <ripple/app/reporting/ReportingETL.h>
#include <ripple/basics/ThreadUtilities.h>

#include <ripple/beast/core/CurrentThreadName.h>
#include <ripple/json/json_reader.h>
#include <ripple/json/json_writer.h>
#include <boost/asio/connect.hpp>
Expand Down Expand Up @@ -509,7 +510,7 @@ ReportingETL::runETLPipeline(uint32_t startSequence)
&startSequence,
&writeConflict,
&transformQueue]() {
this_thread::set_name("ETL extract");
beast::setCurrentThreadName("rippled: ReportingETL extract");
uint32_t currentSequence = startSequence;

// there are two stopping conditions here.
Expand Down Expand Up @@ -561,7 +562,7 @@ ReportingETL::runETLPipeline(uint32_t startSequence)
&writeConflict,
&loadQueue,
&transformQueue]() {
this_thread::set_name("ETL transform");
beast::setCurrentThreadName("rippled: ReportingETL transform");

assert(parent);
parent = std::make_shared<Ledger>(*parent, NetClock::time_point{});
Expand Down Expand Up @@ -600,7 +601,7 @@ ReportingETL::runETLPipeline(uint32_t startSequence)
&lastPublishedSequence,
&loadQueue,
&writeConflict]() {
this_thread::set_name("ETL load");
beast::setCurrentThreadName("rippled: ReportingETL load");
size_t totalTransactions = 0;
double totalTime = 0;
while (!writeConflict)
Expand Down Expand Up @@ -824,7 +825,7 @@ void
ReportingETL::doWork()
{
worker_ = std::thread([this]() {
this_thread::set_name("ETL worker");
beast::setCurrentThreadName("rippled: ReportingETL worker");
if (readOnly_)
monitorReadOnly();
else
Expand Down
140 changes: 0 additions & 140 deletions src/ripple/basics/impl/ThreadUtilities.cpp

This file was deleted.

Loading

0 comments on commit ce570c1

Please sign in to comment.