Added an error message that prints to STDERR when you accidentally

let an exception sit in a thread pool and don't handle it before the
thread pool is destroyed.
This commit is contained in:
Davis King 2016-09-11 08:54:26 -04:00
parent 2cca4ae7f4
commit c7051ef606
1 changed files with 15 additions and 1 deletions

View File

@ -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 (