Catch unhandled exceptions in I/O service threads (RIPD-1166)

This commit is contained in:
Nik Bougalis
2016-06-29 18:15:14 -07:00
committed by seelabs
parent c4f8b38148
commit 16a38f3979

View File

@@ -20,6 +20,7 @@
#include <BeastConfig.h>
#include <ripple/app/main/BasicApp.h>
#include <ripple/beast/core/Thread.h>
#include <ripple/core/ReportUncaughtException.h>
BasicApp::BasicApp(std::size_t numberOfThreads)
{
@@ -27,11 +28,15 @@ BasicApp::BasicApp(std::size_t numberOfThreads)
threads_.reserve(numberOfThreads);
while(numberOfThreads--)
threads_.emplace_back(
[this, numberOfThreads](){
[this, numberOfThreads]()
{
beast::Thread::setCurrentThreadName(
std::string("io_service #") +
std::to_string(numberOfThreads));
this->io_service_.run();
ripple::reportUncaughtException (&io_service_,
&boost::asio::io_service::run,
"io_service::run");
});
}