Changed test to catch throw exceptions from thread creation.

[SVN r41172]
This commit is contained in:
John Maddock
2007-11-17 18:41:29 +00:00
parent 217c317219
commit bddeb83175

View File

@ -163,19 +163,44 @@ int main()
{ {
BOOST_TEST(0 != &up1); BOOST_TEST(0 != &up1);
boost::thread thrd1(&thread1_proc); std::list<boost::shared_ptr<boost::thread> > threads;
boost::thread thrd2(&thread1_proc); for(int i = 0; i < 2; ++i)
boost::thread thrd3(&thread2_proc); {
boost::thread thrd4(&thread2_proc); try{
boost::thread thrd5(&thread3_proc); threads.push_back(boost::shared_ptr<boost::thread>(new boost::thread(&thread1_proc)));
boost::thread thrd6(&thread3_proc); }
catch(const std::exception& e)
{
std::cerr << "<note>Thread creation failed with message: " << e.what() << "</note>" << std::endl;
}
}
for(int i = 0; i < 2; ++i)
{
try{
threads.push_back(boost::shared_ptr<boost::thread>(new boost::thread(&thread2_proc)));
}
catch(const std::exception& e)
{
std::cerr << "<note>Thread creation failed with message: " << e.what() << "</note>" << std::endl;
}
}
for(int i = 0; i < 2; ++i)
{
try{
threads.push_back(boost::shared_ptr<boost::thread>(new boost::thread(&thread3_proc)));
}
catch(const std::exception& e)
{
std::cerr << "<note>Thread creation failed with message: " << e.what() << "</note>" << std::endl;
}
}
thrd1.join(); std::list<boost::shared_ptr<boost::thread> >::const_iterator a(threads.begin()), b(threads.end());
thrd2.join(); while(a != b)
thrd3.join(); {
thrd4.join(); (*a)->join();
thrd5.join(); ++a;
thrd6.join(); }
return total_failures; return total_failures;
} }