diff --git a/build/Jamfile.v2 b/build/Jamfile.v2 index e7177b2b..31f4b091 100644 --- a/build/Jamfile.v2 +++ b/build/Jamfile.v2 @@ -40,6 +40,8 @@ import path ; project boost/thread : source-location ../src : requirements multi + #static:BOOST_THREAD_STATIC_LINK=1 + #shared:BOOST_THREAD_DYN_LINK=1 static:BOOST_THREAD_BUILD_LIB=1 shared:BOOST_THREAD_BUILD_DLL=1 -@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).tag @@ -85,13 +87,15 @@ project boost/thread #clang-2.8:-Wno-unused-function #clang-2.9:-Wno-delete-non-virtual-dtor #clang-2.9:-Wno-unused-function - clang-3.0:-Wno-delete-non-virtual-dtor + clang-3.0:-Wno-delete-non-virtual-dtor #clang-3.0:-Wno-unused-function #clang-3.0:-Wno-unused-variable # : default-build multi : usage-requirements # pass these requirement to dependents (i.e. users) + #static:BOOST_THREAD_STATIC_LINK=1 + #shared:BOOST_THREAD_DYN_LINK=1 static:BOOST_THREAD_BUILD_LIB=1 shared:BOOST_THREAD_BUILD_DLL=1 BOOST_SYSTEM_NO_DEPRECATED @@ -207,7 +211,7 @@ rule usage-requirements ( properties * ) if ! vacpp in $(properties) || 11.1 in $(properties) { result += /boost/chrono//boost_chrono ; - } + } return $(result) ; } @@ -235,7 +239,7 @@ rule requirements ( properties * ) if ! vacpp in $(properties) || 11.1 in $(properties) { result += /boost/chrono//boost_chrono ; - } + } return $(result) ; } diff --git a/doc/changes.qbk b/doc/changes.qbk index 1a43ba95..403c91e5 100644 --- a/doc/changes.qbk +++ b/doc/changes.qbk @@ -8,6 +8,30 @@ [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 + +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] New Features: @@ -64,6 +88,7 @@ Fixed Bugs: * [@http://svn.boost.org/trac/boost/ticket/6959 #6959] call of abs is ambiguous. * 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: 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/example/shared_mutex.cpp b/example/shared_mutex.cpp index 000932f3..ead68c2d 100644 --- a/example/shared_mutex.cpp +++ b/example/shared_mutex.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #if defined BOOST_THREAD_USES_CHRONO #include diff --git a/include/boost/thread/detail/memory.hpp b/include/boost/thread/detail/memory.hpp index 438dd3aa..7d47efc7 100644 --- a/include/boost/thread/detail/memory.hpp +++ b/include/boost/thread/detail/memory.hpp @@ -41,7 +41,7 @@ namespace boost } //namespace thread_detail typedef container::allocator_arg_t allocator_arg_t; - BOOST_CONSTEXPR allocator_arg_t allocator_arg = {}; + BOOST_CONSTEXPR_OR_CONST allocator_arg_t allocator_arg = {}; template struct uses_allocator: public container::uses_allocator diff --git a/include/boost/thread/detail/platform.hpp b/include/boost/thread/detail/platform.hpp index ab9adaaf..1f33b1a6 100644 --- a/include/boost/thread/detail/platform.hpp +++ b/include/boost/thread/detail/platform.hpp @@ -19,7 +19,7 @@ // choose platform #if defined(linux) || defined(__linux) || defined(__linux__) # define BOOST_THREAD_LINUX -# define BOOST_THREAD_WAIT_BUG boost::posix_time::microseconds(100000) +//# define BOOST_THREAD_WAIT_BUG boost::posix_time::microseconds(100000) #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) # define BOOST_THREAD_BSD #elif defined(sun) || defined(__sun) @@ -36,7 +36,7 @@ # define BOOST_THREAD_BEOS #elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) # define BOOST_THREAD_MACOS -# define BOOST_THREAD_WAIT_BUG boost::posix_time::microseconds(1000) +//# define BOOST_THREAD_WAIT_BUG boost::posix_time::microseconds(1000) #elif defined(__IBMCPP__) || defined(_AIX) # define BOOST_THREAD_AIX #elif defined(__amigaos__) diff --git a/include/boost/thread/detail/thread.hpp b/include/boost/thread/detail/thread.hpp index bc202275..3c71b53c 100644 --- a/include/boost/thread/detail/thread.hpp +++ b/include/boost/thread/detail/thread.hpp @@ -582,6 +582,7 @@ namespace boost } #endif +#if defined BOOST_THREAD_PROVIDES_DEPRECATED_FEATURES_SINCE_V3_0_0 inline bool thread::operator==(const thread& other) const { return get_id()==other.get_id(); @@ -591,6 +592,7 @@ namespace boost { return get_id()!=other.get_id(); } +#endif namespace detail { diff --git a/include/boost/thread/future.hpp b/include/boost/thread/future.hpp index c238a574..92f71eef 100644 --- a/include/boost/thread/future.hpp +++ b/include/boost/thread/future.hpp @@ -9,6 +9,12 @@ #define BOOST_THREAD_FUTURE_HPP #include + +// boost::thread::future requires exception handling +// due to boost::exception::exception_ptr dependency + +#ifndef BOOST_NO_EXCEPTIONS + #include #include #include @@ -43,12 +49,16 @@ #include #endif +#include +//#include + #if defined BOOST_THREAD_PROVIDES_FUTURE #define BOOST_THREAD_FUTURE future #else #define BOOST_THREAD_FUTURE unique_future #endif + namespace boost { @@ -1655,8 +1665,39 @@ namespace boost BOOST_THREAD_DCL_MOVABLE_BEG(T) packaged_task BOOST_THREAD_DCL_MOVABLE_END +// template +// BOOST_THREAD_FUTURE::type> +// async(launch policy, F f) +// { +// typedef typename boost::result_of::type R; +// typedef BOOST_THREAD_FUTURE future; +// if (int(policy) & int(launch::async)) +// { +// packaged_task pt( f ); +// +// BOOST_THREAD_FUTURE ret = pt.get_future(); +// boost::thread( boost::move(pt) ).detach(); +// return ::boost::move(ret); +// } +// else if (int(policy) & int(launch::deferred)) +// { +// packaged_task pt( f ); +// +// BOOST_THREAD_FUTURE ret = pt.get_future(); +// return ::boost::move(ret); +// } +// } +// +// template +// BOOST_THREAD_FUTURE::type> +// async(F f) +// { +// return async(launch::any, f); +// } + + } - -#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/include/boost/thread/win32/condition_variable.hpp b/include/boost/thread/win32/condition_variable.hpp index c553a5bf..63f830b1 100644 --- a/include/boost/thread/win32/condition_variable.hpp +++ b/include/boost/thread/win32/condition_variable.hpp @@ -81,9 +81,9 @@ namespace boost return notified; } - bool wait(timeout wait_until) + bool wait(timeout abs_time) { - return this_thread::interruptible_wait(semaphore,wait_until); + return this_thread::interruptible_wait(semaphore,abs_time); } bool woken() @@ -203,7 +203,7 @@ namespace boost protected: template - bool do_wait(lock_type& lock,timeout wait_until) + bool do_wait(lock_type& lock,timeout abs_time) { relocker locker(lock); @@ -214,7 +214,7 @@ namespace boost bool woken=false; while(!woken) { - if(!entry->wait(wait_until)) + if(!entry->wait(abs_time)) { return false; } @@ -225,11 +225,11 @@ namespace boost } template - bool do_wait(lock_type& m,timeout const& wait_until,predicate_type pred) + bool do_wait(lock_type& m,timeout const& abs_time,predicate_type pred) { while (!pred()) { - if(!do_wait(m, wait_until)) + if(!do_wait(m, abs_time)) return pred(); } return true; @@ -314,14 +314,14 @@ namespace boost } - bool timed_wait(unique_lock& m,boost::system_time const& wait_until) + bool timed_wait(unique_lock& m,boost::system_time const& abs_time) { - return do_wait(m,wait_until); + return do_wait(m,abs_time); } - bool timed_wait(unique_lock& m,boost::xtime const& wait_until) + bool timed_wait(unique_lock& m,boost::xtime const& abs_time) { - return do_wait(m,system_time(wait_until)); + return do_wait(m,system_time(abs_time)); } template bool timed_wait(unique_lock& m,duration_type const& wait_duration) @@ -330,14 +330,14 @@ namespace boost } template - bool timed_wait(unique_lock& m,boost::system_time const& wait_until,predicate_type pred) + bool timed_wait(unique_lock& m,boost::system_time const& abs_time,predicate_type pred) { - return do_wait(m,wait_until,pred); + return do_wait(m,abs_time,pred); } template - bool timed_wait(unique_lock& m,boost::xtime const& wait_until,predicate_type pred) + bool timed_wait(unique_lock& m,boost::xtime const& abs_time,predicate_type pred) { - return do_wait(m,system_time(wait_until),pred); + return do_wait(m,system_time(abs_time),pred); } template bool timed_wait(unique_lock& m,duration_type const& wait_duration,predicate_type pred) @@ -422,15 +422,15 @@ namespace boost } template - bool timed_wait(lock_type& m,boost::system_time const& wait_until) + bool timed_wait(lock_type& m,boost::system_time const& abs_time) { - return do_wait(m,wait_until); + return do_wait(m,abs_time); } template - bool timed_wait(lock_type& m,boost::xtime const& wait_until) + bool timed_wait(lock_type& m,boost::xtime const& abs_time) { - return do_wait(m,system_time(wait_until)); + return do_wait(m,system_time(abs_time)); } template @@ -440,15 +440,15 @@ namespace boost } template - bool timed_wait(lock_type& m,boost::system_time const& wait_until,predicate_type pred) + bool timed_wait(lock_type& m,boost::system_time const& abs_time,predicate_type pred) { - return do_wait(m,wait_until,pred); + return do_wait(m,abs_time,pred); } template - bool timed_wait(lock_type& m,boost::xtime const& wait_until,predicate_type pred) + bool timed_wait(lock_type& m,boost::xtime const& abs_time,predicate_type pred) { - return do_wait(m,system_time(wait_until),pred); + return do_wait(m,system_time(abs_time),pred); } template diff --git a/include/boost/thread/win32/thread_primitives.hpp b/include/boost/thread/win32/thread_primitives.hpp index 0166f37d..efd7e6f5 100644 --- a/include/boost/thread/win32/thread_primitives.hpp +++ b/include/boost/thread/win32/thread_primitives.hpp @@ -341,23 +341,42 @@ namespace boost { inline bool interlocked_bit_test_and_set(long* x,long bit) { +#if 0 __asm { mov eax,bit; mov edx,x; lock bts [edx],eax; setc al; }; +#else + bool ret; + __asm { + mov eax,bit; mov edx,x; lock bts [edx],eax; setc al; mov ret, al + }; + return ret; + +#endif } inline bool interlocked_bit_test_and_reset(long* x,long bit) { +#if 0 __asm { mov eax,bit; mov edx,x; lock btr [edx],eax; setc al; }; - } +#else + + + bool ret; + __asm { + mov eax,bit; mov edx,x; lock btr [edx],eax; setc al; mov ret, al + }; + return ret; + +#endif } } } diff --git a/src/future.cpp b/src/future.cpp index 838dfe74..84e823bd 100755 --- a/src/future.cpp +++ b/src/future.cpp @@ -3,6 +3,10 @@ // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +#include +#ifndef BOOST_NO_EXCEPTIONS + + #include namespace boost @@ -54,3 +58,4 @@ namespace boost } } +#endif diff --git a/src/pthread/thread.cpp b/src/pthread/thread.cpp index 0be3cdc9..2b9b95f0 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) { @@ -558,6 +562,7 @@ namespace boost void interruption_point() { +#ifndef BOOST_NO_EXCEPTIONS boost::detail::thread_data_base* const thread_info=detail::get_current_thread_data(); if(thread_info && thread_info->interrupt_enabled) { @@ -568,6 +573,7 @@ namespace boost throw thread_interrupted(); } } +#endif } bool interruption_enabled() BOOST_NOEXCEPT diff --git a/src/win32/thread.cpp b/src/win32/thread.cpp index 5497fe3f..9b6670a6 100644 --- a/src/win32/thread.cpp +++ b/src/win32/thread.cpp @@ -36,33 +36,31 @@ namespace boost #else boost::once_flag current_thread_tls_init_flag=BOOST_ONCE_INIT; #endif - #if defined(UNDER_CE) +#if defined(UNDER_CE) // Windows CE does not define the TLS_OUT_OF_INDEXES constant. - DWORD tls_out_of_index=0xFFFFFFFF; - #else - DWORD tls_out_of_index=TLS_OUT_OF_INDEXES; - #endif - DWORD current_thread_tls_key=tls_out_of_index; +#define TLS_OUT_OF_INDEXES 0xFFFFFFFF +#endif + DWORD current_thread_tls_key=TLS_OUT_OF_INDEXES; void create_current_thread_tls_key() { tss_cleanup_implemented(); // if anyone uses TSS, we need the cleanup linked in current_thread_tls_key=TlsAlloc(); - BOOST_ASSERT(current_thread_tls_key!=tls_out_of_index); + BOOST_ASSERT(current_thread_tls_key!=TLS_OUT_OF_INDEXES); } void cleanup_tls_key() { - if(current_thread_tls_key!=tls_out_of_index) + if(current_thread_tls_key!=TLS_OUT_OF_INDEXES) { TlsFree(current_thread_tls_key); - current_thread_tls_key=tls_out_of_index; + current_thread_tls_key=TLS_OUT_OF_INDEXES; } } detail::thread_data_base* get_current_thread_data() { - if(current_thread_tls_key==tls_out_of_index) + if(current_thread_tls_key==TLS_OUT_OF_INDEXES) { return 0; } @@ -72,7 +70,7 @@ namespace boost void set_current_thread_data(detail::thread_data_base* new_data) { boost::call_once(current_thread_tls_init_flag,create_current_thread_tls_key); - if(current_thread_tls_key!=tls_out_of_index) + if(current_thread_tls_key!=TLS_OUT_OF_INDEXES) BOOST_VERIFY(TlsSetValue(current_thread_tls_key,new_data)); else boost::throw_exception(thread_resource_error()); @@ -185,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(); // } @@ -221,7 +223,7 @@ namespace boost void thread::start_thread(const attributes& attr) { //uintptr_t const new_thread=_beginthreadex(attr.get_security(),attr.get_stack_size(),&thread_start_function,thread_info.get(),CREATE_SUSPENDED,&thread_info->id); - uintptr_t const new_thread=_beginthreadex(0,attr.get_stack_size(),&thread_start_function,thread_info.get(),CREATE_SUSPENDED,&thread_info->id); + uintptr_t const new_thread=_beginthreadex(0,static_cast(attr.get_stack_size()),&thread_start_function,thread_info.get(),CREATE_SUSPENDED,&thread_info->id); if(!new_thread) { boost::throw_exception(thread_resource_error()); @@ -256,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/src/win32/tss_pe.cpp b/src/win32/tss_pe.cpp index 4d756801..0cdb7a6f 100644 --- a/src/win32/tss_pe.cpp +++ b/src/win32/tss_pe.cpp @@ -11,7 +11,7 @@ #if defined(BOOST_HAS_WINTHREADS) && defined(BOOST_THREAD_BUILD_LIB) -#if (defined(__MINGW32__) && !defined(_WIN64)) || defined(__MINGW64__) +#if (defined(__MINGW32__) && !defined(_WIN64)) || defined(__MINGW64__) || (__MINGW64_VERSION_MAJOR) #include @@ -38,7 +38,7 @@ namespace { } } -#if defined(__MINGW64__) || (__MINGW32_MAJOR_VERSION >3) || \ +#if defined(__MINGW64__) || (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION >3) || \ ((__MINGW32_MAJOR_VERSION==3) && (__MINGW32_MINOR_VERSION>=18)) extern "C" { diff --git a/test/sync/futures/async/async_pass.cpp b/test/sync/futures/async/async_pass.cpp index b13c844e..a41aea56 100644 --- a/test/sync/futures/async/async_pass.cpp +++ b/test/sync/futures/async/async_pass.cpp @@ -24,6 +24,8 @@ #include +#include +#include #include #include @@ -49,13 +51,13 @@ void f2() boost::this_thread::sleep_for(ms(200)); } -boost::unique_ptr f3(int i) +boost::interprocess::unique_ptr f3(int i) { boost::this_thread::sleep_for(ms(200)); - return boost::unique_ptr(new int(i)); + return boost::interprocess::unique_ptr(new int(i)); } -boost::unique_ptr f4(boost::unique_ptr&& p) +boost::interprocess::unique_ptr f4(boost::interprocess::unique_ptr&& p) { boost::this_thread::sleep_for(ms(200)); return boost::move(p); @@ -163,7 +165,7 @@ int main() } { - boost::future> f = boost::async(f3, 3); + boost::future> f = boost::async(f3, 3); boost::this_thread::sleep_for(ms(300)); Clock::time_point t0 = Clock::now(); BOOST_TEST(*f.get() == 3); @@ -172,7 +174,7 @@ int main() } { - boost::future> f = boost::async(f4, boost::unique_ptr(new int(3))); + boost::future> f = boost::async(f4, boost::interprocess::unique_ptr(new int(3))); boost::this_thread::sleep_for(ms(300)); Clock::time_point t0 = Clock::now(); BOOST_TEST(*f.get() == 3); 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; } diff --git a/test/test_6170.cpp b/test/test_6170.cpp index 6f2f28fd..4c019074 100644 --- a/test/test_6170.cpp +++ b/test/test_6170.cpp @@ -11,16 +11,16 @@ typedef upgrade_to_unique_lock auto_upgrade_unique_lock; void testUpgrade(void) { - shared_mutex mtx; - auto_upgrade_lock lock(mtx); - // Do some read-only stuff + shared_mutex mtx; + auto_upgrade_lock lock(mtx); + // Do some read-only stuff - auto_upgrade_unique_lock writeLock(lock); - // Do some write-only stuff with the upgraded lock + auto_upgrade_unique_lock writeLock(lock); + // Do some write-only stuff with the upgraded lock } int main() { testUpgrade(); return 0; -} \ No newline at end of file +}