2
0
mirror of https://github.com/boostorg/thread.git synced 2026-01-31 08:42:17 +00:00

Thread: Added some changes to make it work with BOOST_NO_EXCEPTIONS

[SVN r79347]
This commit is contained in:
Vicente J. Botet Escriba
2012-07-08 09:33:13 +00:00
parent c2001fb9d2
commit b305cc29fc
4 changed files with 22 additions and 11 deletions

View File

@@ -138,16 +138,20 @@ namespace boost
boost::detail::thread_data_ptr thread_info = static_cast<boost::detail::thread_data_base*>(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)
{