diff --git a/include/boost/thread/win32/once.hpp b/include/boost/thread/win32/once.hpp index 2d406f84..3066b50b 100644 --- a/include/boost/thread/win32/once.hpp +++ b/include/boost/thread/win32/once.hpp @@ -157,7 +157,9 @@ namespace boost status=BOOST_INTERLOCKED_COMPARE_EXCHANGE(&flag.status,running_value,0); if(!status) { - try +#ifndef BOOST_NO_EXCEPTIONS + try // BOOST_NO_EXCEPTIONS protected +#endif { if(!event_handle) { @@ -185,7 +187,8 @@ namespace boost } break; } - catch(...) +#ifndef BOOST_NO_EXCEPTIONS + catch(...) // BOOST_NO_EXCEPTIONS protected { BOOST_INTERLOCKED_EXCHANGE(&flag.status,0); if(!event_handle) @@ -196,8 +199,9 @@ namespace boost { ::boost::detail::win32::SetEvent(event_handle); } - throw; + throw; // BOOST_NO_EXCEPTIONS protected } +#endif } if(!counted) diff --git a/include/boost/thread/win32/thread_heap_alloc.hpp b/include/boost/thread/win32/thread_heap_alloc.hpp index b7d329f3..843e46b5 100644 --- a/include/boost/thread/win32/thread_heap_alloc.hpp +++ b/include/boost/thread/win32/thread_heap_alloc.hpp @@ -75,16 +75,20 @@ namespace boost inline T* heap_new() { void* const heap_memory=allocate_raw_heap_memory(sizeof(T)); - try +#ifndef BOOST_NO_EXCEPTIONS + try // BOOST_NO_EXCEPTIONS protected +#endif { T* const data=new (heap_memory) T(); return data; } - catch(...) +#ifndef BOOST_NO_EXCEPTIONS + catch(...) // BOOST_NO_EXCEPTIONS protected { free_raw_heap_memory(heap_memory); - throw; + throw; // BOOST_NO_EXCEPTIONS protected } +#endif } #ifndef BOOST_NO_RVALUE_REFERENCES @@ -92,127 +96,159 @@ namespace boost inline T* heap_new(A1&& a1) { void* const heap_memory=allocate_raw_heap_memory(sizeof(T)); - try +#ifndef BOOST_NO_EXCEPTIONS + try // BOOST_NO_EXCEPTIONS protected +#endif { T* const data=new (heap_memory) T(static_cast(a1)); return data; } - catch(...) +#ifndef BOOST_NO_EXCEPTIONS + catch(...) // BOOST_NO_EXCEPTIONS protected { free_raw_heap_memory(heap_memory); - throw; + throw; // BOOST_NO_EXCEPTIONS protected } +#endif } template inline T* heap_new(A1&& a1,A2&& a2) { void* const heap_memory=allocate_raw_heap_memory(sizeof(T)); - try +#ifndef BOOST_NO_EXCEPTIONS + try // BOOST_NO_EXCEPTIONS protected +#endif { T* const data=new (heap_memory) T(static_cast(a1),static_cast(a2)); return data; } - catch(...) +#ifndef BOOST_NO_EXCEPTIONS + catch(...) // BOOST_NO_EXCEPTIONS protected { free_raw_heap_memory(heap_memory); - throw; + throw; // BOOST_NO_EXCEPTIONS protected } +#endif } template inline T* heap_new(A1&& a1,A2&& a2,A3&& a3) { void* const heap_memory=allocate_raw_heap_memory(sizeof(T)); - try +#ifndef BOOST_NO_EXCEPTIONS + try // BOOST_NO_EXCEPTIONS protected +#endif { T* const data=new (heap_memory) T(static_cast(a1),static_cast(a2), static_cast(a3)); return data; } - catch(...) +#ifndef BOOST_NO_EXCEPTIONS + catch(...) // BOOST_NO_EXCEPTIONS protected { free_raw_heap_memory(heap_memory); - throw; + throw; // BOOST_NO_EXCEPTIONS protected } +#endif } template inline T* heap_new(A1&& a1,A2&& a2,A3&& a3,A4&& a4) { void* const heap_memory=allocate_raw_heap_memory(sizeof(T)); - try +#ifndef BOOST_NO_EXCEPTIONS + try // BOOST_NO_EXCEPTIONS protected +#endif { T* const data=new (heap_memory) T(static_cast(a1),static_cast(a2), static_cast(a3),static_cast(a4)); return data; } - catch(...) +#ifndef BOOST_NO_EXCEPTIONS + catch(...) // BOOST_NO_EXCEPTIONS protected { free_raw_heap_memory(heap_memory); - throw; + throw; // BOOST_NO_EXCEPTIONS protected } +#endif } #else template inline T* heap_new_impl(A1 a1) { void* const heap_memory=allocate_raw_heap_memory(sizeof(T)); - try +#ifndef BOOST_NO_EXCEPTIONS + try // BOOST_NO_EXCEPTIONS protected +#endif { T* const data=new (heap_memory) T(a1); return data; } - catch(...) +#ifndef BOOST_NO_EXCEPTIONS + catch(...) // BOOST_NO_EXCEPTIONS protected { free_raw_heap_memory(heap_memory); - throw; + throw; // BOOST_NO_EXCEPTIONS protected } +#endif } template inline T* heap_new_impl(A1 a1,A2 a2) { void* const heap_memory=allocate_raw_heap_memory(sizeof(T)); - try +#ifndef BOOST_NO_EXCEPTIONS + try // BOOST_NO_EXCEPTIONS protected +#endif { T* const data=new (heap_memory) T(a1,a2); return data; } - catch(...) +#ifndef BOOST_NO_EXCEPTIONS + catch(...) // BOOST_NO_EXCEPTIONS protected { free_raw_heap_memory(heap_memory); - throw; + throw; // BOOST_NO_EXCEPTIONS protected } +#endif } template inline T* heap_new_impl(A1 a1,A2 a2,A3 a3) { void* const heap_memory=allocate_raw_heap_memory(sizeof(T)); - try +#ifndef BOOST_NO_EXCEPTIONS + try // BOOST_NO_EXCEPTIONS protected +#endif { T* const data=new (heap_memory) T(a1,a2,a3); return data; } - catch(...) +#ifndef BOOST_NO_EXCEPTIONS + catch(...) // BOOST_NO_EXCEPTIONS protected { free_raw_heap_memory(heap_memory); - throw; + throw; // BOOST_NO_EXCEPTIONS protected } +#endif } template inline T* heap_new_impl(A1 a1,A2 a2,A3 a3,A4 a4) { void* const heap_memory=allocate_raw_heap_memory(sizeof(T)); - try +#ifndef BOOST_NO_EXCEPTIONS + try // BOOST_NO_EXCEPTIONS protected +#endif { T* const data=new (heap_memory) T(a1,a2,a3,a4); return data; } - catch(...) +#ifndef BOOST_NO_EXCEPTIONS + catch(...) // BOOST_NO_EXCEPTIONS protected { free_raw_heap_memory(heap_memory); - throw; + throw; // BOOST_NO_EXCEPTIONS protected } +#endif } diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 853b5916..2217a64b 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -80,9 +80,14 @@ rule thread-run ( sources ) rule thread-test ( sources ) { return - [ run $(sources) ../build//boost_thread : : : /boost/test//boost_unit_test_framework/static ] + [ run $(sources) ../build//boost_thread : : : + /boost/test//boost_unit_test_framework/static + ] [ run $(sources) ../src/tss_null.cpp ../build//boost_thread/static - : : : /boost/test//boost_unit_test_framework/static : $(sources[1]:B)_lib ] + : : : + /boost/test//boost_unit_test_framework/static + : $(sources[1]:B)_lib + ] ; } @@ -160,6 +165,7 @@ rule thread-compile-fail ( sources : reqs * : name ) #[ thread-test test_vhh_shared_mutex_timed_locks.cpp ] ; + #explicit t_futures ; test-suite t_futures : [ thread-test test_futures.cpp ] @@ -194,7 +200,7 @@ rule thread-compile-fail ( sources : reqs * : name ) - #explicit conditions ; + #explicit ts_conditions ; test-suite ts_conditions : [ thread-compile-fail ./sync/conditions/condition_variable/assign_fail.cpp : : condition_variable__assign_f ] @@ -218,13 +224,13 @@ rule thread-compile-fail ( sources : reqs * : name ) [ thread-run2 ./sync/conditions/cv_status/cv_status_pass.cpp : cv_status__cv_status_p ] ; - #explicit async ; + #explicit ts_async ; test-suite ts_async : # [ thread-run2 ./sync/futures/async/async_pass.cpp : async__async_p ] ; - #explicit promise ; + #explicit ts_promise ; test-suite ts_promise : [ thread-compile-fail ./sync/futures/promise/copy_assign_fail.cpp : : promise__copy_assign_f ] @@ -238,7 +244,7 @@ rule thread-compile-fail ( sources : reqs * : name ) [ thread-run2 ./sync/futures/promise/use_allocator_pass.cpp : promise__use_allocator_p ] ; - #explicit future ; + #explicit ts_future ; test-suite ts_future : [ thread-compile-fail ./sync/futures/future/copy_assign_fail.cpp : : future__copy_assign_f ] @@ -251,7 +257,7 @@ rule thread-compile-fail ( sources : reqs * : name ) [ thread-run2 ./sync/futures/future/share_pass.cpp : future__share_p ] ; - #explicit packaged_task ; + #explicit ts_packaged_task ; test-suite ts_packaged_task : [ thread-run2 ./sync/futures/packaged_task/alloc_ctor_pass.cpp : packaged_task__alloc_ctor_p ] @@ -272,7 +278,7 @@ rule thread-compile-fail ( sources : reqs * : name ) ; - #explicit lock_guard ; + #explicit ts_lock_guard ; test-suite ts_lock_guard : [ thread-compile-fail ./sync/mutual_exclusion/locks/lock_guard/copy_assign_fail.cpp : : lock_guard__cons__copy_assign_f ] @@ -282,7 +288,7 @@ rule thread-compile-fail ( sources : reqs * : name ) [ thread-run2 ./sync/mutual_exclusion/locks/lock_guard/types_pass.cpp : lock_guard__types_p ] ; - #explicit unique_lock ; + #explicit ts_unique_lock ; test-suite ts_unique_lock : [ thread-compile-fail ./sync/mutual_exclusion/locks/unique_lock/cons/copy_assign_fail.cpp : : unique_lock__cons__copy_assign_f ] @@ -315,7 +321,7 @@ rule thread-compile-fail ( sources : reqs * : name ) [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/types_pass.cpp : unique_lock__types_p ] ; - #explicit shared_lock ; + #explicit ts_shared_lock ; test-suite ts_shared_lock : [ thread-compile-fail ./sync/mutual_exclusion/locks/shared_lock/cons/copy_assign_fail.cpp : : shared_lock__cons__copy_assign_f ] @@ -345,7 +351,7 @@ rule thread-compile-fail ( sources : reqs * : name ) [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/types_pass.cpp : shared_lock__types_p ] ; - #explicit upgrade_lock ; + #explicit ts_upgrade_lock ; test-suite ts_upgrade_lock : [ thread-compile-fail ./sync/mutual_exclusion/locks/upgrade_lock/cons/copy_assign_fail.cpp : : upgrade_lock__cons__copy_assign_f ] @@ -374,7 +380,7 @@ rule thread-compile-fail ( sources : reqs * : name ) [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/types_pass.cpp : upgrade_lock__types_p ] ; - #explicit mutexs ; + #explicit ts_mutex ; test-suite ts_mutex : [ thread-compile-fail ./sync/mutual_exclusion/mutex/assign_fail.cpp : : mutex__assign_f ] @@ -385,7 +391,7 @@ rule thread-compile-fail ( sources : reqs * : name ) [ thread-run2 ./sync/mutual_exclusion/mutex/try_lock_pass.cpp : mutex__try_lock_p ] ; - #explicit recursive_mutex ; + #explicit ts_recursive_mutex ; test-suite ts_recursive_mutex : [ thread-compile-fail ./sync/mutual_exclusion/recursive_mutex/assign_fail.cpp : : recursive_mutex__assign_f ] @@ -396,7 +402,7 @@ rule thread-compile-fail ( sources : reqs * : name ) [ thread-run2 ./sync/mutual_exclusion/recursive_mutex/try_lock_pass.cpp : recursive_mutex__try_lock_p ] ; - #explicit recursive_timed_mutex ; + #explicit ts_recursive_timed_mutex ; test-suite ts_recursive_timed_mutex : [ thread-compile-fail ./sync/mutual_exclusion/recursive_timed_mutex/assign_fail.cpp : : recursive_timed_mutex__assign_f ] @@ -409,7 +415,7 @@ rule thread-compile-fail ( sources : reqs * : name ) [ thread-run2 ./sync/mutual_exclusion/recursive_timed_mutex/try_lock_until_pass.cpp : recursive_timed_mutex__try_lock_until_p ] ; - #explicit timed_mutex ; + #explicit ts_timed_mutex ; test-suite ts_timed_mutex : [ thread-compile-fail ./sync/mutual_exclusion/timed_mutex/assign_fail.cpp : : timed_mutex__assign_f ] @@ -422,7 +428,7 @@ rule thread-compile-fail ( sources : reqs * : name ) [ thread-run2 ./sync/mutual_exclusion/timed_mutex/try_lock_until_pass.cpp : timed_mutex__try_lock_until_p ] ; - #explicit shared_mutexs ; + #explicit ts_shared_mutex ; test-suite ts_shared_mutex : [ thread-compile-fail ./sync/mutual_exclusion/shared_mutex/assign_fail.cpp : : shared_mutex__assign_f ] @@ -435,7 +441,7 @@ rule thread-compile-fail ( sources : reqs * : name ) ; - #explicit this_thread ; + #explicit ts_this_thread ; test-suite ts_this_thread : [ thread-run2 ./threads/this_thread/get_id/get_id_pass.cpp : this_thread__get_id_p ] @@ -443,7 +449,7 @@ rule thread-compile-fail ( sources : reqs * : name ) [ thread-run2 ./threads/this_thread/sleep_until/sleep_until_pass.cpp : this_thread__sleep_until_p ] ; - #explicit thread ; + #explicit ts_thread ; test-suite ts_thread : [ thread-compile-fail ./threads/thread/assign/copy_fail.cpp : : thread__assign__copy_f ] @@ -474,7 +480,7 @@ rule thread-compile-fail ( sources : reqs * : name ) [ thread-run2 ./threads/container/thread_ptr_list_pass.cpp : container__thread_ptr_list_p ] ; - #explicit examples ; + #explicit ts_examples ; test-suite ts_examples : [ thread-run ../example/monitor.cpp ] @@ -494,7 +500,7 @@ rule thread-compile-fail ( sources : reqs * : name ) #[ thread-run ../example/vhh_shared_mutex.cpp ] ; - #explicit shared_upwards ; + #explicit ts_shared_upwards ; test-suite ts_shared_upwards : [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/move_ctor_shared_lock_try_pass.cpp : unique_lock__cons__move_ctor_shared_lock_try_p ] @@ -507,7 +513,7 @@ rule thread-compile-fail ( sources : reqs * : name ) ; - #explicit shared_lock_guard ; + #explicit ts_shared_lock_guard ; test-suite ts_shared_lock_guard : [ thread-compile-fail ./sync/mutual_exclusion/locks/shared_lock_guard/copy_assign_fail.cpp : : shared_lock_guard__cons__copy_assign_f ] @@ -517,7 +523,7 @@ rule thread-compile-fail ( sources : reqs * : name ) [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock_guard/types_pass.cpp : shared_lock_guard__types_p ] ; - #explicit reverse_lock ; + #explicit ts_reverse_lock ; test-suite ts_reverse_lock : [ thread-compile-fail ./sync/mutual_exclusion/locks/reverse_lock/copy_assign_fail.cpp : : reverse_lock__copy_assign_f ] diff --git a/test/threads/this_thread/sleep_for/sleep_for_pass.cpp b/test/threads/this_thread/sleep_for/sleep_for_pass.cpp index 0f1e26c9..ce325dcc 100644 --- a/test/threads/this_thread/sleep_for/sleep_for_pass.cpp +++ b/test/threads/this_thread/sleep_for/sleep_for_pass.cpp @@ -36,7 +36,7 @@ int main() boost::chrono::nanoseconds err = ms / 100; // The time slept is within 1% of 500ms // This test is spurious as it depends on the time the thread system switches the threads - BOOST_TEST(std::max(ns.count(), -ns.count()) < (err+boost::chrono::milliseconds(1000)).count()); + BOOST_TEST((std::max)(ns.count(), -ns.count()) < (err+boost::chrono::milliseconds(1000)).count()); //BOOST_TEST(std::abs(static_cast(ns.count())) < (err+boost::chrono::milliseconds(1000)).count()); return boost::report_errors(); diff --git a/test/threads/this_thread/sleep_until/sleep_until_pass.cpp b/test/threads/this_thread/sleep_until/sleep_until_pass.cpp index 5a959d41..4adcd3c9 100644 --- a/test/threads/this_thread/sleep_until/sleep_until_pass.cpp +++ b/test/threads/this_thread/sleep_until/sleep_until_pass.cpp @@ -36,7 +36,7 @@ int main() boost::chrono::nanoseconds err = ms / 100; // The time slept is within 1% of 500ms // This test is spurious as it depends on the time the thread system switches the threads - BOOST_TEST(std::max(ns.count(), -ns.count()) < (err+boost::chrono::milliseconds(1000)).count()); + BOOST_TEST((std::max)(ns.count(), -ns.count()) < (err+boost::chrono::milliseconds(1000)).count()); //BOOST_TEST(std::abs(static_cast(ns.count())) < (err+boost::chrono::milliseconds(1000)).count()); return boost::report_errors();