diff --git a/include/boost/thread/future.hpp b/include/boost/thread/future.hpp index 91a585fa..72a2a23a 100644 --- a/include/boost/thread/future.hpp +++ b/include/boost/thread/future.hpp @@ -52,6 +52,11 @@ #define BOOST_THREAD_FUTURE unique_future #endif +// boost::thread::future requires exception handling +// due to boost::exception::exception_ptr dependency + +#ifndef BOOST_NO_EXCEPTIONS + namespace boost { @@ -1692,5 +1697,5 @@ namespace boost } - -#endif +#endif // BOOST_NO_EXCEPTION +#endif // header diff --git a/include/boost/thread/pthread/once.hpp b/include/boost/thread/pthread/once.hpp index 6abf265b..80aa09ee 100644 --- a/include/boost/thread/pthread/once.hpp +++ b/include/boost/thread/pthread/once.hpp @@ -78,18 +78,18 @@ namespace boost { flag.epoch=being_initialized; #ifndef BOOST_NO_EXCEPTIONS - try + try // BOOST_NO_EXCEPTIONS protected { #endif pthread::pthread_mutex_scoped_unlock relocker(&detail::once_epoch_mutex); f(); #ifndef BOOST_NO_EXCEPTIONS } - catch(...) + catch(...) // BOOST_NO_EXCEPTIONS protected { flag.epoch=uninitialized_flag; BOOST_VERIFY(!pthread_cond_broadcast(&detail::once_epoch_cv)); - throw; + throw; // BOOST_NO_EXCEPTIONS protected } #endif flag.epoch=--detail::once_global_epoch; diff --git a/include/boost/thread/pthread/thread_data.hpp b/include/boost/thread/pthread/thread_data.hpp index 352a7ef2..5f84799f 100644 --- a/include/boost/thread/pthread/thread_data.hpp +++ b/include/boost/thread/pthread/thread_data.hpp @@ -129,11 +129,13 @@ namespace boost void check_for_interruption() { +#ifndef BOOST_NO_EXCEPTIONS if(thread_info->interrupt_requested) { thread_info->interrupt_requested=false; - throw thread_interrupted(); + throw thread_interrupted(); // BOOST_NO_EXCEPTIONS protected } +#endif } void operator=(interruption_checker&); diff --git a/src/pthread/thread.cpp b/src/pthread/thread.cpp index 0be3cdc9..c496268f 100644 --- a/src/pthread/thread.cpp +++ b/src/pthread/thread.cpp @@ -138,16 +138,20 @@ namespace boost boost::detail::thread_data_ptr thread_info = static_cast(param)->self; thread_info->self.reset(); detail::set_current_thread_data(thread_info.get()); - try +#ifndef BOOST_NO_EXCEPTIONS + try // BOOST_NO_EXCEPTIONS protected +#endif { thread_info->run(); } - catch(thread_interrupted const&) +#ifndef BOOST_NO_EXCEPTIONS + catch(thread_interrupted const&) // BOOST_NO_EXCEPTIONS protected { } +#endif // Removed as it stops the debugger identifying the cause of the exception // Unhandled exceptions still cause the application to terminate -// catch(...) +// catch(...) // BOOST_NO_EXCEPTIONS protected // { // std::terminate(); // } @@ -221,14 +225,14 @@ namespace boost if (res != 0) { thread_info->self.reset(); - throw thread_resource_error(); + boost::throw_exception(thread_resource_error()); } int detached_state; res = pthread_attr_getdetachstate(h, &detached_state); if (res != 0) { thread_info->self.reset(); - throw thread_resource_error(); + boost::throw_exception(thread_resource_error()); } if (PTHREAD_CREATE_DETACHED==detached_state) {