the io_service run/run_once/poll should be called in a try-catch_all block in thread function in thread pools
the io_service->run should be guarded by a try catch(...) and exceptions should be logged (if possible):
void
IoServiceThreadPool::threadWork() {
bool done = false;
while (!done) {
switch (getState()) {
case State::RUNNING: {
{
std::unique_lock<std::mutex> lck(mutex_);
running_++;
// If We're all running notify main thread.
if (running_ == pool_size_) {
main_cv_.notify_all();
}
}
// try { <<<---
// Run the IOService.
io_service_->run();
// } catch(exception& ex) { <<<---
// LOG the exception error here <<<---
// } catch (...) { <<<---
// LOG general error here <<<---
// } <<<---
Edited by Razvan Becheriu