Catch exceptions thrown from thread creation.

[SVN r41089]
This commit is contained in:
John Maddock
2007-11-14 13:03:15 +00:00
parent f11333d352
commit bed800b315

View File

@ -75,7 +75,13 @@ int cpp_main(int /*argc*/, char * /*argv*/[])
std::list<boost::shared_ptr<boost::thread> > threads;
for(int i = 0; i < 5; ++i)
{
threads.push_back(boost::shared_ptr<boost::thread>(new boost::thread(&run_tests)));
try{
threads.push_back(boost::shared_ptr<boost::thread>(new boost::thread(&run_tests)));
}
catch(const std::exception& e)
{
std::cerr << "<note>Thread creation failed with message: " << e.what() << "</note>" << std::endl;
}
}
std::list<boost::shared_ptr<boost::thread> >::const_iterator a(threads.begin()), b(threads.end());
while(a != b)