From bcf30f2dfc444871578a137259a424106cfe46ee Mon Sep 17 00:00:00 2001 From: "Vicente J. Botet Escriba" Date: Mon, 9 Jul 2012 16:50:35 +0000 Subject: [PATCH] Thread: cleanup no-exceptions on windows [SVN r79384] --- doc/changes.qbk | 62 +++++++++++++++++++++++++++++++------------ doc/configuration.qbk | 6 +++-- doc/thread.qbk | 2 +- src/win32/thread.cpp | 20 +++++++++----- test/test_4882.cpp | 4 +++ 5 files changed, 68 insertions(+), 26 deletions(-) diff --git a/doc/changes.qbk b/doc/changes.qbk index 95d60c42..9100e275 100644 --- a/doc/changes.qbk +++ b/doc/changes.qbk @@ -8,8 +8,53 @@ [section:changes History] +[heading Version 3.0.1 - boost 1.51] + +New Features: + +* [@http://svn.boost.org/trac/boost/ticket/2100 #2100] thread fails to compile with -fno-exceptions + +Deprecated features since boost 1.50 available only until boost 1.55: + +These deprecated features will be provided by default up to boost 1.52. If you don't want to include the deprecated features you could define BOOST_THREAD_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V3_0_0. Since 1.53 these features will not be included any more by default. Since this version, if you want to include the deprecated features yet you could define BOOST_THREAD_PROVIDE_DEPRECATED_FEATURES_SINCE_V3_0_0. These deprecated features will be only available until boost 1.55, that is you have 1 year and a half to move to the new features. + +* Time related functions don't using the Boost.Chrono library, use the chrono overloads instead. + +Breaking changes when BOOST_THREAD_VERSION==3: + +There are some new features which share the same interface but with different behavior. These breaking features are provided by default when BOOST_THREAD_VERSION is 3, but the user can however choose the version 2 behavior by defining the corresponding macro. As for the deprecated features, these broken features will be only available until boost 1.55. + +* [@http://svn.boost.org/trac/boost/ticket/6229 #6229] Rename the unique_future to future following the c++11. +* [@http://svn.boost.org/trac/boost/ticket/6266 #6266] Breaking change: thread destructor should call terminate if joinable. +* [@http://svn.boost.org/trac/boost/ticket/6269 #6269] Breaking change: thread move assignment should call terminate if joinable. + + +Fixed Bugs: + + +* [@http://svn.boost.org/trac/boost/ticket/4258 #4258] Linking with boost thread does not work on mingw/gcc 4.5. +* [@http://svn.boost.org/trac/boost/ticket/4885 #4885] Access violation in set_tss_data at process exit due to invalid assumption about TlsAlloc. +* [@http://svn.boost.org/trac/boost/ticket/6931 #6931] mutex waits forwever with Intel Compiler and /debug:parallel +* [@http://svn.boost.org/trac/boost/ticket/7044 #7044] boost 1.50.0 header missing. +* [@http://svn.boost.org/trac/boost/ticket/7052 #7052] Thread: BOOST_THREAD_PROVIDES_DEPRECATED_FEATURES_SINCE_V3_0_0 only masks thread::operator==, thread::operator!= forward declarations, not definitions. +* [@http://svn.boost.org/trac/boost/ticket/7066 #7066] An attempt to fix current_thread_tls_key static initialization order. +* [@http://svn.boost.org/trac/boost/ticket/7074 #7074] Multiply defined symbol boost::allocator_arg. +* [@http://svn.boost.org/trac/boost/ticket/7078 #7078] Trivial 64-bit warning fix on Windows for thread attribute stack size +* [@http://svn.boost.org/trac/boost/ticket/7089 #7089] BOOST_THREAD_WAIT_BUG limits functionality without solving anything + +[/ +#6787 boost::thread::sleep() hangs if system time is rolled back +#7045 Thread library does not automatically compile date_time +] + [heading Version 3.0.0 - boost 1.50] +Breaking changes when BOOST_THREAD_VERSION==3: + +* [@http://svn.boost.org/trac/boost/ticket/6229 #6229] Breaking change: Rename the unique_future to future following the c++11. +* [@http://svn.boost.org/trac/boost/ticket/6266 #6266] Breaking change: thread destructor should call terminate if joinable. +* [@http://svn.boost.org/trac/boost/ticket/6269 #6269] Breaking change: thread move assignment should call terminate if joinable. + New Features: * [@http://svn.boost.org/trac/boost/ticket/1850 #1850] Request for unlock_guard to compliment lock_guard. @@ -23,11 +68,8 @@ New Features: * [@http://svn.boost.org/trac/boost/ticket/6225 #6225] Add the use of standard =delete defaulted operations on compilers supporting them. * [@http://svn.boost.org/trac/boost/ticket/6226 #6226] c++11 compliance: Add explicit bool conversion from locks. * [@http://svn.boost.org/trac/boost/ticket/6228 #6228] Add promise constructor with allocator following the standard c++11. -* [@http://svn.boost.org/trac/boost/ticket/6229 #6229] Rename the unique_future to future following the c++11. * [@http://svn.boost.org/trac/boost/ticket/6230 #6230] c++11 compliance: Follows the exception reporting mechanism as defined in the c++11. * [@http://svn.boost.org/trac/boost/ticket/6231 #6231] Add BasicLockable requirements in the documentation to follow c++11. -* [@http://svn.boost.org/trac/boost/ticket/6266 #6266] Breaking change: thread destructor should call terminate if joinable. -* [@http://svn.boost.org/trac/boost/ticket/6269 #6269] Breaking change: thread move assignment should call terminate if joinable. * [@http://svn.boost.org/trac/boost/ticket/6272 #6272] c++11 compliance: Add thread::id hash specialization. * [@http://svn.boost.org/trac/boost/ticket/6273 #6273] c++11 compliance: Add cv_status enum class and use it on the conditions wait functions. * [@http://svn.boost.org/trac/boost/ticket/6342 #6342] c++11 compliance: Adapt the one_flag to the c++11 interface. @@ -65,20 +107,6 @@ Fixed Bugs: * Fix issue signaled on the ML with task_object(task_object const&) in presence of task_object(task_object &&) -[/ -Deprecated features since boost 1.50 available only until boost 1.55: - -These deprecated features will be provided by default up to boost 1.52. If you don't want to include the deprecated features you could define BOOST_THREAD_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V3_0_0. Since 1.53 these features will not be included any more by default. Since this version, if you want to include the deprecated features yet you could define BOOST_THREAD_PROVIDE_DEPRECATED_FEATURES_SINCE_V3_0_0. These deprecated features will be only available until boost 1.55, that is you have 1 year and a half to move to the new features. - -* Time related functions don't using the Boost.Chrono library, use the chrono overloads instead. - -Breaking changes: - -There are some new features which share the same interface but with different behavior. These breaking features are provided by default when BOOST_THREAD_VERSION is 2, but the user can however choose the version 1 behavior by defining the corresponding macro. As for the deprecated features, these broken features will be only available until boost 1.55. - -* #6266 c++11 compliance: thread destructor should call terminate if joinable -* #6269 c++11 compliance: thread move assignment should call terminate if joinable -] [heading Version 2.1.1 - boost 1.49] diff --git a/doc/configuration.qbk b/doc/configuration.qbk index 4652cf35..a6856860 100644 --- a/doc/configuration.qbk +++ b/doc/configuration.qbk @@ -167,12 +167,12 @@ These deprecated features will be provided by default up to boost 1.52. If you d [section:version Version] `BOOST_THREAD_VERSION` defines the Boost.Thread version. -The default version is 1. In this case the following breaking or extending macros are defined if the opposite is not requested: +The default version is 2. In this case the following breaking or extending macros are defined if the opposite is not requested: * `BOOST_THREAD_PROVIDES_PROMISE_LAZY` * `BOOST_THREAD_PROVIDES_DEPRECATED_FEATURES_SINCE_V3_0_0` -The user can request the version 2 by defining `BOOST_THREAD_VERSION` to 2. In this case the following breaking or extending macros are defined if the opposite is not requested: +The user can request the version 3 by defining `BOOST_THREAD_VERSION` to 3. In this case the following breaking or extending macros are defined if the opposite is not requested: * Breaking change `BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION ` * Breaking change `BOOST_THREAD_PROVIDES_FUTURE` @@ -186,6 +186,8 @@ The user can request the version 2 by defining `BOOST_THREAD_VERSION` to 2. In t * Breaking change `BOOST_THREAD_DONT_PROVIDE_PROMISE_LAZY` * Breaking change `BOOST_THREAD_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V3_0_0` +The default value for `BOOST_THREAD_VERSION` will be changed to 3 since Boost 1.53. + [endsect] [endsect] diff --git a/doc/thread.qbk b/doc/thread.qbk index 0ea1bca8..6e4abcc0 100644 --- a/doc/thread.qbk +++ b/doc/thread.qbk @@ -8,7 +8,7 @@ [library Thread [quickbook 1.5] - [version 3.0.0] + [version 3.0.1] [authors [Williams, Anthony] [Botet Escriba, Vicente J.]] [copyright 2007-11 Anthony Williams] [copyright 2011-12 Vicente J. Botet Escriba] diff --git a/src/win32/thread.cpp b/src/win32/thread.cpp index dc65a72b..9b6670a6 100644 --- a/src/win32/thread.cpp +++ b/src/win32/thread.cpp @@ -183,16 +183,20 @@ namespace boost { detail::thread_data_base* const thread_info(reinterpret_cast(param)); set_current_thread_data(thread_info); - 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(); // } @@ -254,15 +258,19 @@ namespace boost void make_external_thread_data() { externally_launched_thread* me=detail::heap_new(); - try +#ifndef BOOST_NO_EXCEPTIONS + try // BOOST_NO_EXCEPTIONS protected +#endif { set_current_thread_data(me); } - catch(...) +#ifndef BOOST_NO_EXCEPTIONS + catch(...) // BOOST_NO_EXCEPTIONS protected { detail::heap_delete(me); - throw; + throw; // BOOST_NO_EXCEPTIONS protected } +#endif } detail::thread_data_base* get_or_make_current_thread_data() diff --git a/test/test_4882.cpp b/test/test_4882.cpp index 88dab8d9..2c9d031f 100644 --- a/test/test_4882.cpp +++ b/test/test_4882.cpp @@ -8,7 +8,9 @@ boost::shared_mutex mutex; void thread() { std::cout << __FILE__ << ":" << __LINE__ << std::endl; +#ifndef BOOST_NO_EXCEPTIONS try +#endif { for (int i =0; i<10; ++i) { @@ -23,10 +25,12 @@ void thread() } } } +#ifndef BOOST_NO_EXCEPTIONS catch (boost::lock_error& le) { std::cerr << "lock_error exception\n"; } +#endif std::cout << __FILE__ << ":" << __LINE__ << std::endl; }