Ticket #6266: 6266.patch
File 6266.patch, 9.5 KB (added by , 11 years ago) |
---|
-
boost/thread/detail/config.hpp
45 45 #define BOOST_THREAD_SHARED_MUTEX_GENERIC 46 46 #endif 47 47 48 49 48 // Don't provided by default in version 1. 50 49 #if defined BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION 51 50 #define BOOST_THREAD_EXPLICIT_LOCK_CONVERSION explicit … … 64 63 #endif 65 64 66 65 #if BOOST_THREAD_VERSION==2 66 #define BOOST_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE 67 #define BOOST_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE 67 68 #define BOOST_THREAD_USES_FUTURE 68 69 #define BOOST_THREAD_FUTURE_USES_ALLOCATORS 69 70 #define BOOST_THREAD_SHARED_MUTEX_PROVIDES_UPWARDS_CONVERSION -
boost/thread/detail/thread.hpp
208 208 thread(const volatile thread&); 209 209 #endif 210 210 thread() BOOST_NOEXCEPT; 211 ~thread(); 212 211 ~thread() 212 { 213 #if defined BOOST_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE 214 if (joinable()) { 215 std::terminate(); 216 } 217 #else 218 detach(); 219 #endif 220 } 213 221 #ifndef BOOST_NO_RVALUE_REFERENCES 214 222 template < 215 223 class F … … 239 247 240 248 thread& operator=(thread&& other) BOOST_NOEXCEPT 241 249 { 250 #if defined BOOST_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE 251 if (joinable()) std::terminate(); 252 #endif 242 253 thread_info=other.thread_info; 243 254 other.thread_info.reset(); 244 255 return *this; … … 354 365 #if defined BOOST_THREAD_USES_MOVE 355 366 thread& operator=(boost::rv<thread>& x) BOOST_NOEXCEPT 356 367 { 368 #if defined BOOST_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE 369 if (joinable()) std::terminate(); 370 #endif 357 371 thread new_thread(boost::move(x)); 358 372 swap(new_thread); 359 373 return *this; … … 361 375 #else 362 376 thread& operator=(detail::thread_move_t<thread> x) BOOST_NOEXCEPT 363 377 { 378 #if defined BOOST_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE 379 if (joinable()) std::terminate(); 380 #endif 364 381 thread new_thread(x); 365 382 swap(new_thread); 366 383 return *this; -
libs/thread/test/threads/thread/destr/dtor_pass.cpp
17 17 18 18 // ~thread(); 19 19 20 #define BOOST_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE 21 20 22 #include <boost/thread/thread.hpp> 21 23 #include <new> 22 24 #include <cstdlib> … … 58 60 59 61 void f1() 60 62 { 61 std::exit( 0);63 std::exit(boost::report_errors()); 62 64 } 63 65 64 66 int main() … … 71 73 #if defined BOOST_THREAD_USES_CHRONO 72 74 boost::this_thread::sleep_for(boost::chrono::milliseconds(250)); 73 75 #endif 76 BOOST_TEST(t.joinable()); 74 77 } 75 #if 076 78 BOOST_TEST(false); 77 #endif78 79 return boost::report_errors(); 79 80 } 80 81 -
libs/thread/test/threads/thread/assign/move_pass.cpp
18 18 19 19 // thread& operator=(thread&& t); 20 20 21 #define BOOST_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE 22 21 23 #include <boost/thread/thread.hpp> 22 24 #include <new> 23 25 #include <cstdlib> … … 69 71 70 72 void f1() 71 73 { 72 std::exit( 0);74 std::exit(boost::report_errors()); 73 75 } 74 76 75 77 int main() … … 85 87 BOOST_TEST(t1.get_id() == id); 86 88 BOOST_TEST(t0.get_id() == boost::thread::id()); 87 89 t1.join(); 88 #if 089 BOOST_TEST(G::n_alive == 0);90 #endif91 90 BOOST_TEST(G::op_run); 92 91 } 92 BOOST_TEST(G::n_alive == 0); 93 93 { 94 94 boost::thread t0(G(), 5, 5.5); 95 95 boost::thread::id id = t0.get_id(); 96 96 boost::thread t1; 97 97 t0 = boost::move(t1); 98 #if 099 98 BOOST_TEST(false); 100 #endif101 99 } 102 100 return boost::report_errors(); 103 101 } -
libs/thread/doc/thread_ref.qbk
462 462 [variablelist 463 463 464 464 [[Effects:] [Transfers ownership of the thread managed by `other` (if 465 any) to `*this`. If there was a thread previously associated with466 `*this` then that thread is detached .]]465 any) to `*this`. Version 1: If there was a thread previously associated with 466 `*this` then that thread is detached, version 2: If the thread is joinable calls to std::terminate.]] 467 467 468 468 [[Postconditions:] [`other->get_id()==thread::id()` and `get_id()` returns the value of `other.get_id()` prior to the assignment.]] 469 469 … … 620 620 621 621 [variablelist 622 622 623 [[Effects:] [ If `*this` has an associated thread of execution, calls __detach__. Destroys `*this`.]]623 [[Effects:] [Version 1: If `*this` has an associated thread of execution, calls __detach__, Version 2: If the thread is joinable calls to std::terminate. Destroys `*this`.]] 624 624 625 625 [[Throws:] [Nothing.]] 626 626 -
libs/thread/doc/configuration.qbk
117 117 118 118 [endsect] 119 119 120 [section:terminate Call to terminate if joinable] 120 121 122 C++11 has a different semantic for the thread destructor and the move assignment. Instead of detaching the thread, calls to terminate() if the thread was joinable. When `BOOST_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE` and `BOOST_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE` is defined Boost.Thread provides the C++ semantic. 121 123 124 [endsect] 125 126 122 127 [section:version `BOOST_THREAD_VERSION` Version] 123 128 124 129 `BOOST_THREAD_VERSION` defines the Boost.Thread version. … … 130 135 * Breaking change `BOOST_THREAD_USES_FUTURE` 131 136 * Uniformity `BOOST_THREAD_SHARED_MUTEX_GENERIC` 132 137 * Extension `BOOST_THREAD_SHARED_MUTEX_PROVIDES_UPWARDS_CONVERSION` 133 * Extension `BOOST_THREAD_FUTURE_USES_ALLOCATORS` 138 * Conformity `BOOST_THREAD_FUTURE_USES_ALLOCATORS` 139 * Breaking change BOOST_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE 140 * Breaking change BOOST_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE 134 141 135 136 142 [endsect] 137 143 138 144 [endsect] 139 No newline at end of file -
libs/thread/doc/changes.qbk
23 23 * [@http://svn.boost.org/trac/boost/ticket/6226 #6226] c++11 compliance: Add explicit bool conversion from locks. 24 24 * [@http://svn.boost.org/trac/boost/ticket/6228 #6228] Add promise constructor with allocator following the standard c++11. 25 25 * [@http://svn.boost.org/trac/boost/ticket/6230 #6230] c++11 compliance: Follows the exception reporting mechanism as defined in the c++11. 26 * [@http://svn.boost.org/trac/boost/ticket/6266 #6266] Breaking change: thread destructor should call terminate if joinable. 27 * [@http://svn.boost.org/trac/boost/ticket/6269 #6269] Breaking change: thread move assignment should call terminate if joinable. 26 28 * [@http://svn.boost.org/trac/boost/ticket/6272 #6272] c++11 compliance: Add thread::id hash specialization. 27 29 * [@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. 28 30 * [@http://svn.boost.org/trac/boost/ticket/6231 #6231] Add BasicLockable requirements in the documentation to follow c++11. 29 31 * [@http://svn.boost.org/trac/boost/ticket/6671 #6671] upgrade_lock: missing mutex and release functions. 30 32 * [@http://svn.boost.org/trac/boost/ticket/6672 #6672] upgrade_lock:: missing constructors from time related types. 31 33 * [@http://svn.boost.org/trac/boost/ticket/6675 #6675] upgrade_lock:: missing non-member swap. 34 32 35 33 36 Fixed Bugs: 34 37 … … 176 179 # Complete the C++11 missing features, in particular 177 180 178 181 * [@http://svn.boost.org/trac/boost/ticket/4710 #4710] Missing async(). 179 * [@http://svn.boost.org/trac/boost/ticket/6266 #6266] Breaking change: thread destructor should call terminate if joinable.180 * [@http://svn.boost.org/trac/boost/ticket/6269 #6269] Breaking change: thread move assignment should call terminate if joinable.181 182 * [@http://svn.boost.org/trac/boost/ticket/6342 #6342] Breaking change: Adapt the one_flag and call_once to the c++11 interface. 182 183 183 184 * [@http://svn.boost.org/trac/boost/ticket/6227 #6227] Use of variadic templates on Generic Locking Algorithms on compilers providing them. -
libs/thread/src/win32/thread.cpp
271 271 272 272 } 273 273 274 thread::~thread()275 {276 detach();277 }278 279 274 thread::id thread::get_id() const BOOST_NOEXCEPT 280 275 { 281 276 return thread::id((get_thread_info)()); -
libs/thread/src/pthread/thread.cpp
244 244 } 245 245 } 246 246 247 thread::~thread()248 {249 detach();250 }251 247 248 252 249 detail::thread_data_ptr thread::get_thread_info BOOST_PREVENT_MACRO_SUBSTITUTION () const 253 250 { 254 251 return thread_info;