Better fatal error reporting
This commit is contained in:
@@ -17,16 +17,32 @@
|
||||
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "utils/Logger.hpp"
|
||||
#include "utils/IOContextRunner.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
#include "utils/Logger.hpp"
|
||||
|
||||
IOContextRunner::IOContextRunner(boost::asio::io_service& ioService, std::size_t threadCount)
|
||||
: _ioService {ioService}
|
||||
, _work {ioService}
|
||||
{
|
||||
LMS_LOG(UTILS, INFO) << "Starting IO Context with " << threadCount << " threads...";
|
||||
for (std::size_t i {}; i < threadCount; ++i)
|
||||
_threads.emplace_back([&] { _ioService.run(); });
|
||||
{
|
||||
_threads.emplace_back([&]
|
||||
{
|
||||
try
|
||||
{
|
||||
_ioService.run();
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
LMS_LOG(UTILS, FATAL) << "Exception caught in IO context: " << e.what();
|
||||
std::abort();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user