From c9d8fa9e9651cb31e4bb3efde1e345be6829d970 Mon Sep 17 00:00:00 2001 From: seelabs Date: Tue, 5 Jul 2016 14:48:37 -0400 Subject: [PATCH] Rename reportUncaughtExceptions to threadEntry --- Builds/VisualStudio2015/RippleD.vcxproj | 4 ++-- Builds/VisualStudio2015/RippleD.vcxproj.filters | 6 +++--- src/ripple/app/ledger/impl/LedgerCleaner.cpp | 4 ++-- src/ripple/app/main/BasicApp.cpp | 4 ++-- src/ripple/app/main/LoadManager.cpp | 4 ++-- src/ripple/app/misc/SHAMapStoreImp.cpp | 4 ++-- .../{ReportUncaughtException.h => ThreadEntry.h} | 14 +++++++------- src/ripple/core/impl/DeadlineTimer.cpp | 4 ++-- src/ripple/core/impl/Job.cpp | 4 ++-- src/ripple/core/impl/SNTPClock.cpp | 4 ++-- src/ripple/core/impl/Workers.cpp | 4 ++-- .../core/tests/ReportUncaughtException.test.cpp | 12 ++++++------ src/ripple/nodestore/impl/DatabaseImp.h | 4 ++-- src/ripple/resource/impl/ResourceManager.cpp | 4 ++-- src/ripple/websocket/Server.h | 4 ++-- 15 files changed, 40 insertions(+), 40 deletions(-) rename src/ripple/core/{ReportUncaughtException.h => ThreadEntry.h} (92%) diff --git a/Builds/VisualStudio2015/RippleD.vcxproj b/Builds/VisualStudio2015/RippleD.vcxproj index c60aa5f23..25a6eab61 100644 --- a/Builds/VisualStudio2015/RippleD.vcxproj +++ b/Builds/VisualStudio2015/RippleD.vcxproj @@ -2050,8 +2050,6 @@ - - @@ -2092,6 +2090,8 @@ ..\..\src\soci\src\core;..\..\src\sqlite;%(AdditionalIncludeDirectories) ..\..\src\soci\src\core;..\..\src\sqlite;%(AdditionalIncludeDirectories) + + diff --git a/Builds/VisualStudio2015/RippleD.vcxproj.filters b/Builds/VisualStudio2015/RippleD.vcxproj.filters index af26d08d3..8214e8077 100644 --- a/Builds/VisualStudio2015/RippleD.vcxproj.filters +++ b/Builds/VisualStudio2015/RippleD.vcxproj.filters @@ -2592,9 +2592,6 @@ ripple\core - - ripple\core - ripple\core @@ -2619,6 +2616,9 @@ ripple\core\tests + + ripple\core + ripple\core diff --git a/src/ripple/app/ledger/impl/LedgerCleaner.cpp b/src/ripple/app/ledger/impl/LedgerCleaner.cpp index 4303a391b..cd50540fd 100644 --- a/src/ripple/app/ledger/impl/LedgerCleaner.cpp +++ b/src/ripple/app/ledger/impl/LedgerCleaner.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include @@ -243,7 +243,7 @@ private: void run () { - reportUncaughtException ( + threadEntry ( this, &LedgerCleanerImp::runImpl, "LedgerCleanerImp::run()"); } diff --git a/src/ripple/app/main/BasicApp.cpp b/src/ripple/app/main/BasicApp.cpp index 5a25fdbaa..e44c8384e 100644 --- a/src/ripple/app/main/BasicApp.cpp +++ b/src/ripple/app/main/BasicApp.cpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include BasicApp::BasicApp(std::size_t numberOfThreads) { @@ -34,7 +34,7 @@ BasicApp::BasicApp(std::size_t numberOfThreads) std::string("io_service #") + std::to_string(numberOfThreads)); - ripple::reportUncaughtException (&io_service_, + ripple::threadEntry (&io_service_, &boost::asio::io_service::run, "io_service::run"); }); diff --git a/src/ripple/app/main/LoadManager.cpp b/src/ripple/app/main/LoadManager.cpp index 3ae8e442b..3b674ad41 100644 --- a/src/ripple/app/main/LoadManager.cpp +++ b/src/ripple/app/main/LoadManager.cpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include @@ -108,7 +108,7 @@ void LoadManager::onStop () void LoadManager::run () { - reportUncaughtException (this, &LoadManager::runImpl, "LoadManager::run()"); + threadEntry (this, &LoadManager::runImpl, "LoadManager::run()"); } void LoadManager::runImpl () diff --git a/src/ripple/app/misc/SHAMapStoreImp.cpp b/src/ripple/app/misc/SHAMapStoreImp.cpp index 80f039b20..76ad533f3 100644 --- a/src/ripple/app/misc/SHAMapStoreImp.cpp +++ b/src/ripple/app/misc/SHAMapStoreImp.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include @@ -298,7 +298,7 @@ SHAMapStoreImp::copyNode (std::uint64_t& nodeCount, void SHAMapStoreImp::run() { - reportUncaughtException ( + threadEntry ( this, &SHAMapStoreImp::runImpl, "SHAMapStoreImp::run()"); } diff --git a/src/ripple/core/ReportUncaughtException.h b/src/ripple/core/ThreadEntry.h similarity index 92% rename from src/ripple/core/ReportUncaughtException.h rename to src/ripple/core/ThreadEntry.h index 03996713d..f6108f9cc 100644 --- a/src/ripple/core/ReportUncaughtException.h +++ b/src/ripple/core/ThreadEntry.h @@ -17,8 +17,8 @@ */ //============================================================================== -#ifndef RIPPLE_CORE_REPORT_UNCAUGHT_EXCEPTION_H_INCLUDED -#define RIPPLE_CORE_REPORT_UNCAUGHT_EXCEPTION_H_INCLUDED +#ifndef RIPPLE_CORE_THREAD_ENTRY_H_INCLUDED +#define RIPPLE_CORE_THREAD_ENTRY_H_INCLUDED #include #include // forced_unwind exception @@ -52,7 +52,7 @@ uncaught exception. The lambda is only called in the error case. Usage example -#include +#include #include #include #include @@ -62,7 +62,7 @@ class ThreadedHandler public: void operator() () { - reportUncaughtException ( + threadEntry ( this, &ThreadedHandler::runImpl, "ThreadedHandler::operator()"); } @@ -90,7 +90,7 @@ int main () @param lamdba Optional lambda that returns additional text for the log. */ template -void reportUncaughtException ( +void threadEntry ( T* t, R (T::*threadTop) (), char const* name, L&& lambda) { // Enforce that lambda takes no parameters and returns std::string. @@ -142,10 +142,10 @@ void reportUncaughtException ( // Handle the common case where there is no additional local information. template -inline void reportUncaughtException ( +inline void threadEntry ( T* t, R (T::*threadTop) (), char const* name) { - reportUncaughtException (t, threadTop, name, []{ return std::string(); }); + threadEntry (t, threadTop, name, []{ return std::string(); }); } } // namespace ripple diff --git a/src/ripple/core/impl/DeadlineTimer.cpp b/src/ripple/core/impl/DeadlineTimer.cpp index 6c1a85749..58117c56f 100644 --- a/src/ripple/core/impl/DeadlineTimer.cpp +++ b/src/ripple/core/impl/DeadlineTimer.cpp @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include #include @@ -100,7 +100,7 @@ public: void run () override { - reportUncaughtException ( + threadEntry ( this, &Manager::runImpl, "DeadlineTimer::Manager::run()"); } diff --git a/src/ripple/core/impl/Job.cpp b/src/ripple/core/impl/Job.cpp index be62cbda0..5102d9078 100644 --- a/src/ripple/core/impl/Job.cpp +++ b/src/ripple/core/impl/Job.cpp @@ -19,7 +19,7 @@ #include #include -#include +#include #include namespace ripple { @@ -77,7 +77,7 @@ bool Job::shouldCancel () const void Job::doJob () { - reportUncaughtException (this, &Job::doJobImpl, "Job::doJob()", + threadEntry (this, &Job::doJobImpl, "Job::doJob()", [this] () { std::stringstream ss; diff --git a/src/ripple/core/impl/SNTPClock.cpp b/src/ripple/core/impl/SNTPClock.cpp index 3357dd41d..60ce9067a 100644 --- a/src/ripple/core/impl/SNTPClock.cpp +++ b/src/ripple/core/impl/SNTPClock.cpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include @@ -209,7 +209,7 @@ public: using Pio_service_mem = std::size_t (boost::asio::io_service::*)(); Pio_service_mem pRun = &boost::asio::io_service::run; - reportUncaughtException (&io_service_, pRun, "SNTPClientImp::doRun()"); + threadEntry (&io_service_, pRun, "SNTPClientImp::doRun()"); } void diff --git a/src/ripple/core/impl/Workers.cpp b/src/ripple/core/impl/Workers.cpp index f399e6f52..ce8270cf2 100644 --- a/src/ripple/core/impl/Workers.cpp +++ b/src/ripple/core/impl/Workers.cpp @@ -18,7 +18,7 @@ //============================================================================== #include -#include +#include #include #include @@ -159,7 +159,7 @@ Workers::Worker::~Worker () void Workers::Worker::run () { // Call runImpl() and report if any exceptions escape runImpl. - reportUncaughtException (this, &Workers::Worker::runImpl, + threadEntry (this, &Workers::Worker::runImpl, "Workers::Worker::run()", [this] () { return "Thread: " + Thread::getThreadName(); diff --git a/src/ripple/core/tests/ReportUncaughtException.test.cpp b/src/ripple/core/tests/ReportUncaughtException.test.cpp index d1ada49de..744259eb9 100644 --- a/src/ripple/core/tests/ReportUncaughtException.test.cpp +++ b/src/ripple/core/tests/ReportUncaughtException.test.cpp @@ -21,11 +21,11 @@ #include #include -#include +#include namespace ripple { -// reportUncaughtException is disabled if NO_LOG_UNHANDLED_EXCEPTIONS is defined. +// threadEntry is disabled if NO_LOG_UNHANDLED_EXCEPTIONS is defined. #ifndef NO_LOG_UNHANDLED_EXCEPTIONS class ReportUncaughtException_test : public TestSuite @@ -96,11 +96,11 @@ public: ExceptionGen exGen; // Make sure nothing gets logged if there's no exception. - reportUncaughtException (&exGen, &ExceptionGen::dontThrow, "noThrow"); + threadEntry (&exGen, &ExceptionGen::dontThrow, "noThrow"); expect (sinkRef.getText() == ""); sinkRef.reset(); - reportUncaughtException (&exGen, &ExceptionGen::dontThrow, "noThrow", + threadEntry (&exGen, &ExceptionGen::dontThrow, "noThrow", [] { return "Just noise"; }); expect (sinkRef.getText() == ""); @@ -117,7 +117,7 @@ public: bool gotException = false; try { - reportUncaughtException (&exGen, call, "testFn"); + threadEntry (&exGen, call, "testFn"); } catch (...) { @@ -131,7 +131,7 @@ public: gotException = false; try { - reportUncaughtException (&exGen, call, "testFn", + threadEntry (&exGen, call, "testFn", []{ return "extra info"; }); } catch (...) diff --git a/src/ripple/nodestore/impl/DatabaseImp.h b/src/ripple/nodestore/impl/DatabaseImp.h index 8ae8b48bb..736accd9d 100644 --- a/src/ripple/nodestore/impl/DatabaseImp.h +++ b/src/ripple/nodestore/impl/DatabaseImp.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include @@ -337,7 +337,7 @@ public: // Uncaught exception handling for async read threads void threadEntry () { - reportUncaughtException ( + ::ripple::threadEntry ( this, &DatabaseImp::threadEntryImpl, "DatabaseImp::threadEntry()"); } diff --git a/src/ripple/resource/impl/ResourceManager.cpp b/src/ripple/resource/impl/ResourceManager.cpp index a2c00274e..823945c0b 100644 --- a/src/ripple/resource/impl/ResourceManager.cpp +++ b/src/ripple/resource/impl/ResourceManager.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include #include @@ -114,7 +114,7 @@ public: private: void run () { - reportUncaughtException ( + threadEntry ( this, &ManagerImp::runImpl, "Resource::Manager::run()"); } diff --git a/src/ripple/websocket/Server.h b/src/ripple/websocket/Server.h index e4b2f95f5..5ceef5771 100644 --- a/src/ripple/websocket/Server.h +++ b/src/ripple/websocket/Server.h @@ -21,7 +21,7 @@ #define RIPPLE_WEBSOCKET_SERVER_H_INCLUDED #include -#include +#include #include #include #include @@ -60,7 +60,7 @@ public: private: void run () { - reportUncaughtException ( + threadEntry ( this, &Server::runImpl, "Server::run()"); }