diff --git a/dlib/threads/thread_pool_extension.h b/dlib/threads/thread_pool_extension.h index e928cd946..43b1258ed 100644 --- a/dlib/threads/thread_pool_extension.h +++ b/dlib/threads/thread_pool_extension.h @@ -505,7 +505,21 @@ namespace dlib ~thread_pool ( ) { - impl->shutdown_pool(); + try + { + impl->shutdown_pool(); + } + catch (std::exception& e) + { + std::cerr << "An unhandled exception was inside a dlib::thread_pool when it was destructed." << std::endl; + std::cerr << "It's what string is: \n" << e.what() << std::endl; + throw; + } + catch (...) + { + std::cerr << "An unhandled exception was inside a dlib::thread_pool when it was destructed." << std::endl; + throw; + } } void wait_for_task (