Rename reportUncaughtExceptions to threadEntry

This commit is contained in:
seelabs
2016-07-05 14:48:37 -04:00
parent b72724a4a4
commit c9d8fa9e96
15 changed files with 40 additions and 40 deletions

View File

@@ -2050,8 +2050,6 @@
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\ripple\core\LoadMonitor.h"> <ClInclude Include="..\..\src\ripple\core\LoadMonitor.h">
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\ripple\core\ReportUncaughtException.h">
</ClInclude>
<ClInclude Include="..\..\src\ripple\core\SociDB.h"> <ClInclude Include="..\..\src\ripple\core\SociDB.h">
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\ripple\core\Stoppable.h"> <ClInclude Include="..\..\src\ripple\core\Stoppable.h">
@@ -2092,6 +2090,8 @@
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='debug.classic|x64'">..\..\src\soci\src\core;..\..\src\sqlite;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='debug.classic|x64'">..\..\src\soci\src\core;..\..\src\sqlite;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='release.classic|x64'">..\..\src\soci\src\core;..\..\src\sqlite;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='release.classic|x64'">..\..\src\soci\src\core;..\..\src\sqlite;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\ripple\core\ThreadEntry.h">
</ClInclude>
<ClInclude Include="..\..\src\ripple\core\TimeKeeper.h"> <ClInclude Include="..\..\src\ripple\core\TimeKeeper.h">
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\ripple\crypto\csprng.h"> <ClInclude Include="..\..\src\ripple\crypto\csprng.h">

View File

@@ -2592,9 +2592,6 @@
<ClInclude Include="..\..\src\ripple\core\LoadMonitor.h"> <ClInclude Include="..\..\src\ripple\core\LoadMonitor.h">
<Filter>ripple\core</Filter> <Filter>ripple\core</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\ripple\core\ReportUncaughtException.h">
<Filter>ripple\core</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ripple\core\SociDB.h"> <ClInclude Include="..\..\src\ripple\core\SociDB.h">
<Filter>ripple\core</Filter> <Filter>ripple\core</Filter>
</ClInclude> </ClInclude>
@@ -2619,6 +2616,9 @@
<ClCompile Include="..\..\src\ripple\core\tests\Stoppable.test.cpp"> <ClCompile Include="..\..\src\ripple\core\tests\Stoppable.test.cpp">
<Filter>ripple\core\tests</Filter> <Filter>ripple\core\tests</Filter>
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\ripple\core\ThreadEntry.h">
<Filter>ripple\core</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ripple\core\TimeKeeper.h"> <ClInclude Include="..\..\src\ripple\core\TimeKeeper.h">
<Filter>ripple\core</Filter> <Filter>ripple\core</Filter>
</ClInclude> </ClInclude>

View File

@@ -22,7 +22,7 @@
#include <ripple/app/ledger/InboundLedgers.h> #include <ripple/app/ledger/InboundLedgers.h>
#include <ripple/app/ledger/LedgerMaster.h> #include <ripple/app/ledger/LedgerMaster.h>
#include <ripple/core/LoadFeeTrack.h> #include <ripple/core/LoadFeeTrack.h>
#include <ripple/core/ReportUncaughtException.h> #include <ripple/core/ThreadEntry.h>
#include <ripple/protocol/JsonFields.h> #include <ripple/protocol/JsonFields.h>
#include <ripple/beast/core/Thread.h> #include <ripple/beast/core/Thread.h>
@@ -243,7 +243,7 @@ private:
void run () void run ()
{ {
reportUncaughtException ( threadEntry (
this, &LedgerCleanerImp::runImpl, "LedgerCleanerImp::run()"); this, &LedgerCleanerImp::runImpl, "LedgerCleanerImp::run()");
} }

View File

@@ -20,7 +20,7 @@
#include <BeastConfig.h> #include <BeastConfig.h>
#include <ripple/app/main/BasicApp.h> #include <ripple/app/main/BasicApp.h>
#include <ripple/beast/core/Thread.h> #include <ripple/beast/core/Thread.h>
#include <ripple/core/ReportUncaughtException.h> #include <ripple/core/ThreadEntry.h>
BasicApp::BasicApp(std::size_t numberOfThreads) BasicApp::BasicApp(std::size_t numberOfThreads)
{ {
@@ -34,7 +34,7 @@ BasicApp::BasicApp(std::size_t numberOfThreads)
std::string("io_service #") + std::string("io_service #") +
std::to_string(numberOfThreads)); std::to_string(numberOfThreads));
ripple::reportUncaughtException (&io_service_, ripple::threadEntry (&io_service_,
&boost::asio::io_service::run, &boost::asio::io_service::run,
"io_service::run"); "io_service::run");
}); });

View File

@@ -23,7 +23,7 @@
#include <ripple/app/misc/NetworkOPs.h> #include <ripple/app/misc/NetworkOPs.h>
#include <ripple/basics/UptimeTimer.h> #include <ripple/basics/UptimeTimer.h>
#include <ripple/core/LoadFeeTrack.h> #include <ripple/core/LoadFeeTrack.h>
#include <ripple/core/ReportUncaughtException.h> #include <ripple/core/ThreadEntry.h>
#include <ripple/json/to_string.h> #include <ripple/json/to_string.h>
#include <ripple/beast/core/Thread.h> #include <ripple/beast/core/Thread.h>
#include <memory> #include <memory>
@@ -108,7 +108,7 @@ void LoadManager::onStop ()
void LoadManager::run () void LoadManager::run ()
{ {
reportUncaughtException (this, &LoadManager::runImpl, "LoadManager::run()"); threadEntry (this, &LoadManager::runImpl, "LoadManager::run()");
} }
void LoadManager::runImpl () void LoadManager::runImpl ()

View File

@@ -25,7 +25,7 @@
#include <ripple/app/main/Application.h> #include <ripple/app/main/Application.h>
#include <ripple/basics/contract.h> #include <ripple/basics/contract.h>
#include <ripple/core/ConfigSections.h> #include <ripple/core/ConfigSections.h>
#include <ripple/core/ReportUncaughtException.h> #include <ripple/core/ThreadEntry.h>
#include <boost/format.hpp> #include <boost/format.hpp>
#include <boost/format.hpp> #include <boost/format.hpp>
#include <boost/optional.hpp> #include <boost/optional.hpp>
@@ -298,7 +298,7 @@ SHAMapStoreImp::copyNode (std::uint64_t& nodeCount,
void void
SHAMapStoreImp::run() SHAMapStoreImp::run()
{ {
reportUncaughtException ( threadEntry (
this, &SHAMapStoreImp::runImpl, "SHAMapStoreImp::run()"); this, &SHAMapStoreImp::runImpl, "SHAMapStoreImp::run()");
} }

View File

@@ -17,8 +17,8 @@
*/ */
//============================================================================== //==============================================================================
#ifndef RIPPLE_CORE_REPORT_UNCAUGHT_EXCEPTION_H_INCLUDED #ifndef RIPPLE_CORE_THREAD_ENTRY_H_INCLUDED
#define RIPPLE_CORE_REPORT_UNCAUGHT_EXCEPTION_H_INCLUDED #define RIPPLE_CORE_THREAD_ENTRY_H_INCLUDED
#include <ripple/basics/Log.h> #include <ripple/basics/Log.h>
#include <boost/coroutine/exceptions.hpp> // forced_unwind exception #include <boost/coroutine/exceptions.hpp> // forced_unwind exception
@@ -52,7 +52,7 @@ uncaught exception. The lambda is only called in the error case.
Usage example Usage example
#include <ripple/core/ReportUncaughtException.h> #include <ripple/core/ThreadEntry.h>
#include <chrono> #include <chrono>
#include <exception> #include <exception>
#include <thread> #include <thread>
@@ -62,7 +62,7 @@ class ThreadedHandler
public: public:
void operator() () void operator() ()
{ {
reportUncaughtException ( threadEntry (
this, &ThreadedHandler::runImpl, "ThreadedHandler::operator()"); this, &ThreadedHandler::runImpl, "ThreadedHandler::operator()");
} }
@@ -90,7 +90,7 @@ int main ()
@param lamdba Optional lambda that returns additional text for the log. @param lamdba Optional lambda that returns additional text for the log.
*/ */
template <typename T, typename R, typename L> template <typename T, typename R, typename L>
void reportUncaughtException ( void threadEntry (
T* t, R (T::*threadTop) (), char const* name, L&& lambda) T* t, R (T::*threadTop) (), char const* name, L&& lambda)
{ {
// Enforce that lambda takes no parameters and returns std::string. // 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. // Handle the common case where there is no additional local information.
template <typename T, typename R> template <typename T, typename R>
inline void reportUncaughtException ( inline void threadEntry (
T* t, R (T::*threadTop) (), char const* name) T* t, R (T::*threadTop) (), char const* name)
{ {
reportUncaughtException (t, threadTop, name, []{ return std::string(); }); threadEntry (t, threadTop, name, []{ return std::string(); });
} }
} // namespace ripple } // namespace ripple

View File

@@ -19,7 +19,7 @@
#include <BeastConfig.h> #include <BeastConfig.h>
#include <ripple/core/DeadlineTimer.h> #include <ripple/core/DeadlineTimer.h>
#include <ripple/core/ReportUncaughtException.h> #include <ripple/core/ThreadEntry.h>
#include <ripple/beast/core/Thread.h> #include <ripple/beast/core/Thread.h>
#include <algorithm> #include <algorithm>
#include <cassert> #include <cassert>
@@ -100,7 +100,7 @@ public:
void run () override void run () override
{ {
reportUncaughtException ( threadEntry (
this, &Manager::runImpl, "DeadlineTimer::Manager::run()"); this, &Manager::runImpl, "DeadlineTimer::Manager::run()");
} }

View File

@@ -19,7 +19,7 @@
#include <BeastConfig.h> #include <BeastConfig.h>
#include <ripple/core/Job.h> #include <ripple/core/Job.h>
#include <ripple/core/ReportUncaughtException.h> #include <ripple/core/ThreadEntry.h>
#include <cassert> #include <cassert>
namespace ripple { namespace ripple {
@@ -77,7 +77,7 @@ bool Job::shouldCancel () const
void Job::doJob () void Job::doJob ()
{ {
reportUncaughtException (this, &Job::doJobImpl, "Job::doJob()", threadEntry (this, &Job::doJobImpl, "Job::doJob()",
[this] () [this] ()
{ {
std::stringstream ss; std::stringstream ss;

View File

@@ -23,7 +23,7 @@
#include <ripple/basics/ThreadName.h> #include <ripple/basics/ThreadName.h>
#include <ripple/basics/random.h> #include <ripple/basics/random.h>
#include <ripple/beast/core/Thread.h> #include <ripple/beast/core/Thread.h>
#include <ripple/core/ReportUncaughtException.h> #include <ripple/core/ThreadEntry.h>
#include <beast/core/placeholders.hpp> #include <beast/core/placeholders.hpp>
#include <boost/asio.hpp> #include <boost/asio.hpp>
#include <boost/optional.hpp> #include <boost/optional.hpp>
@@ -209,7 +209,7 @@ public:
using Pio_service_mem = std::size_t (boost::asio::io_service::*)(); using Pio_service_mem = std::size_t (boost::asio::io_service::*)();
Pio_service_mem pRun = &boost::asio::io_service::run; Pio_service_mem pRun = &boost::asio::io_service::run;
reportUncaughtException (&io_service_, pRun, "SNTPClientImp::doRun()"); threadEntry (&io_service_, pRun, "SNTPClientImp::doRun()");
} }
void void

View File

@@ -18,7 +18,7 @@
//============================================================================== //==============================================================================
#include <ripple/core/impl/Workers.h> #include <ripple/core/impl/Workers.h>
#include <ripple/core/ReportUncaughtException.h> #include <ripple/core/ThreadEntry.h>
#include <ripple/beast/unit_test.h> #include <ripple/beast/unit_test.h>
#include <cassert> #include <cassert>
@@ -159,7 +159,7 @@ Workers::Worker::~Worker ()
void Workers::Worker::run () void Workers::Worker::run ()
{ {
// Call runImpl() and report if any exceptions escape runImpl. // Call runImpl() and report if any exceptions escape runImpl.
reportUncaughtException (this, &Workers::Worker::runImpl, threadEntry (this, &Workers::Worker::runImpl,
"Workers::Worker::run()", [this] () "Workers::Worker::run()", [this] ()
{ {
return "Thread: " + Thread::getThreadName(); return "Thread: " + Thread::getThreadName();

View File

@@ -21,11 +21,11 @@
#include <ripple/basics/Log.h> #include <ripple/basics/Log.h>
#include <ripple/basics/TestSuite.h> #include <ripple/basics/TestSuite.h>
#include <ripple/core/ReportUncaughtException.h> #include <ripple/core/ThreadEntry.h>
namespace ripple { 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 #ifndef NO_LOG_UNHANDLED_EXCEPTIONS
class ReportUncaughtException_test : public TestSuite class ReportUncaughtException_test : public TestSuite
@@ -96,11 +96,11 @@ public:
ExceptionGen exGen; ExceptionGen exGen;
// Make sure nothing gets logged if there's no exception. // Make sure nothing gets logged if there's no exception.
reportUncaughtException (&exGen, &ExceptionGen::dontThrow, "noThrow"); threadEntry (&exGen, &ExceptionGen::dontThrow, "noThrow");
expect (sinkRef.getText() == ""); expect (sinkRef.getText() == "");
sinkRef.reset(); sinkRef.reset();
reportUncaughtException (&exGen, &ExceptionGen::dontThrow, "noThrow", threadEntry (&exGen, &ExceptionGen::dontThrow, "noThrow",
[] { return "Just noise"; }); [] { return "Just noise"; });
expect (sinkRef.getText() == ""); expect (sinkRef.getText() == "");
@@ -117,7 +117,7 @@ public:
bool gotException = false; bool gotException = false;
try try
{ {
reportUncaughtException (&exGen, call, "testFn"); threadEntry (&exGen, call, "testFn");
} }
catch (...) catch (...)
{ {
@@ -131,7 +131,7 @@ public:
gotException = false; gotException = false;
try try
{ {
reportUncaughtException (&exGen, call, "testFn", threadEntry (&exGen, call, "testFn",
[]{ return "extra info"; }); []{ return "extra info"; });
} }
catch (...) catch (...)

View File

@@ -26,7 +26,7 @@
#include <ripple/basics/KeyCache.h> #include <ripple/basics/KeyCache.h>
#include <ripple/basics/Log.h> #include <ripple/basics/Log.h>
#include <ripple/basics/chrono.h> #include <ripple/basics/chrono.h>
#include <ripple/core/ReportUncaughtException.h> #include <ripple/core/ThreadEntry.h>
#include <ripple/protocol/digest.h> #include <ripple/protocol/digest.h>
#include <ripple/basics/Slice.h> #include <ripple/basics/Slice.h>
#include <ripple/basics/TaggedCache.h> #include <ripple/basics/TaggedCache.h>
@@ -337,7 +337,7 @@ public:
// Uncaught exception handling for async read threads // Uncaught exception handling for async read threads
void threadEntry () void threadEntry ()
{ {
reportUncaughtException ( ::ripple::threadEntry (
this, &DatabaseImp::threadEntryImpl, "DatabaseImp::threadEntry()"); this, &DatabaseImp::threadEntryImpl, "DatabaseImp::threadEntry()");
} }

View File

@@ -22,7 +22,7 @@
#include <ripple/resource/impl/Logic.h> #include <ripple/resource/impl/Logic.h>
#include <ripple/basics/chrono.h> #include <ripple/basics/chrono.h>
#include <ripple/basics/Log.h> #include <ripple/basics/Log.h>
#include <ripple/core/ReportUncaughtException.h> #include <ripple/core/ThreadEntry.h>
#include <ripple/beast/core/Thread.h> #include <ripple/beast/core/Thread.h>
#include <condition_variable> #include <condition_variable>
#include <memory> #include <memory>
@@ -114,7 +114,7 @@ public:
private: private:
void run () void run ()
{ {
reportUncaughtException ( threadEntry (
this, &ManagerImp::runImpl, "Resource::Manager::run()"); this, &ManagerImp::runImpl, "Resource::Manager::run()");
} }

View File

@@ -21,7 +21,7 @@
#define RIPPLE_WEBSOCKET_SERVER_H_INCLUDED #define RIPPLE_WEBSOCKET_SERVER_H_INCLUDED
#include <ripple/basics/Log.h> #include <ripple/basics/Log.h>
#include <ripple/core/ReportUncaughtException.h> #include <ripple/core/ThreadEntry.h>
#include <ripple/websocket/WebSocket.h> #include <ripple/websocket/WebSocket.h>
#include <ripple/beast/core/Thread.h> #include <ripple/beast/core/Thread.h>
#include <condition_variable> #include <condition_variable>
@@ -60,7 +60,7 @@ public:
private: private:
void run () void run ()
{ {
reportUncaughtException ( threadEntry (
this, &Server::runImpl, "Server<WebSocket>::run()"); this, &Server::runImpl, "Server<WebSocket>::run()");
} }