From bed800b3157ee6c5007a095a20e2ce6ecbbd86e7 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Wed, 14 Nov 2007 13:03:15 +0000 Subject: [PATCH] Catch exceptions thrown from thread creation. [SVN r41089] --- test/regress/main.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/regress/main.cpp b/test/regress/main.cpp index b157caab..c09dd581 100644 --- a/test/regress/main.cpp +++ b/test/regress/main.cpp @@ -75,7 +75,13 @@ int cpp_main(int /*argc*/, char * /*argv*/[]) std::list > threads; for(int i = 0; i < 5; ++i) { - threads.push_back(boost::shared_ptr(new boost::thread(&run_tests))); + try{ + threads.push_back(boost::shared_ptr(new boost::thread(&run_tests))); + } + catch(const std::exception& e) + { + std::cerr << "Thread creation failed with message: " << e.what() << "" << std::endl; + } } std::list >::const_iterator a(threads.begin()), b(threads.end()); while(a != b)