diff --git a/.travis.yml b/.travis.yml index 40d98acb..80dd11ce 100644 --- a/.travis.yml +++ b/.travis.yml @@ -329,21 +329,21 @@ matrix: - ubuntu-toolchain-r-test - llvm-toolchain-trusty-4.0 - - os: osx - compiler: clang++ - env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++98 +# - os: osx +# compiler: clang++ +# env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++98 - - os: osx - compiler: clang++ - env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++11 +# - os: osx +# compiler: clang++ +# env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++11 - - os: osx - compiler: clang++ - env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++14 +# - os: osx +# compiler: clang++ +# env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++14 - - os: osx - compiler: clang++ - env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++1z +# - os: osx +# compiler: clang++ +# env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++1z install: - BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true diff --git a/doc/changes.qbk b/doc/changes.qbk index d20777e1..b986d205 100644 --- a/doc/changes.qbk +++ b/doc/changes.qbk @@ -22,14 +22,29 @@ Please take a look at [@https://svn.boost.org/trac/boost/query?status=assigned&s Please take a look at [@http://www.boost.org/development/tests/master/developer/thread.html thread master regression test] to see the last regression test snapshot. [*Fixed Bugs:] + +* [@http://svn.boost.org/trac/boost/ticket/12323 #12323] windows - boost/thread/win32/mfc_thread_init.hpp has wrong signature for _pRawDllMainOrig +* [@http://svn.boost.org/trac/boost/ticket/12730 #12730] windows - static threads library is incompatible with MSVC 2017 RC * [@http://svn.boost.org/trac/boost/ticket/12976 #12976] Boost Thread Executors documentation mistakes * [@http://svn.boost.org/trac/boost/ticket/12949 #12949] using sleep_for in a thread context without including boost/thread/thread.hpp yields incorrect behaviour when BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC is defined * [@http://svn.boost.org/trac/boost/ticket/13019 #13019] ABI compatibility for BOOST_THREAD_PROVIDES_INTERRUPTIONS incomplete +* [@http://svn.boost.org/trac/boost/ticket/13069 #13069] Boost unit test "sync_pq_multi_thread_p_lib.exe" hung in thread library * [@http://svn.boost.org/trac/boost/ticket/13163 #13163] boost::detail::heap_new does not have a variadic variant +* [@http://svn.boost.org/trac/boost/ticket/13226 #13226] getpagesize() is deprecated since 199506L + +* [@https://github.com/boostorg/thread/issues/132 #132] VS 2017.4 Preview deadlocks on Test 10964 +* [@https://github.com/boostorg/thread/issues/133 #133] windows - Spurious timing test failures on windows +* [@https://github.com/boostorg/thread/issues/134 #134] VS 2017.4 Preview deadlock in sync_pq_multi_thread_p_lib.exe +* [@https://github.com/boostorg/thread/issues/135 #135] VS 2017.4 Preview test_scheduled_tp_p.exe deadlock +* [@https://github.com/boostorg/thread/issues/136 #136] VS 2017.4 Preview test_scheduler_p.exe deadlock +* [@https://github.com/boostorg/thread/issues/137 #137] VS 2017.4 Preview executor_ex.exe deadlock +* [@https://github.com/boostorg/thread/issues/143 #143] Failures on msvc-12.0 +* [@https://github.com/boostorg/thread/issues/145 #145] Clang build error with BOOST_THREAD_ATTRIBUTE_MAY_ALIAS [*New Experimental Features:] +* [@https://github.com/boostorg/thread/issues/116 #116] [Proposal] Add APIs for deferred set_value/exception [heading Version 4.7.5 - boost 1.65.1] diff --git a/include/boost/detail/atomic_redef_macros.hpp b/include/boost/thread/detail/atomic_redef_macros.hpp similarity index 100% rename from include/boost/detail/atomic_redef_macros.hpp rename to include/boost/thread/detail/atomic_redef_macros.hpp diff --git a/include/boost/detail/atomic_undef_macros.hpp b/include/boost/thread/detail/atomic_undef_macros.hpp similarity index 100% rename from include/boost/detail/atomic_undef_macros.hpp rename to include/boost/thread/detail/atomic_undef_macros.hpp diff --git a/include/boost/thread/future.hpp b/include/boost/thread/future.hpp index 5874e55f..120f0fb6 100644 --- a/include/boost/thread/future.hpp +++ b/include/boost/thread/future.hpp @@ -159,7 +159,7 @@ namespace boost boost::function callback; // This declaration should be only included conditionally, but is included to maintain the same layout. continuations_type continuations; - executor_ptr_type ex; + executor_ptr_type ex_; // This declaration should be only included conditionally, but is included to maintain the same layout. virtual void launch_continuation() @@ -173,18 +173,18 @@ namespace boost is_constructed(false), policy_(launch::none), continuations(), - ex() + ex_() {} - shared_state_base(exceptional_ptr const& ex_): - exception(ex_.ptr_), + shared_state_base(exceptional_ptr const& ex): + exception(ex.ptr_), done(true), is_valid_(true), is_deferred_(false), is_constructed(false), policy_(launch::none), continuations(), - ex() + ex_() {} @@ -199,23 +199,23 @@ namespace boost executor_ptr_type get_executor() { - return ex; + return ex_; } void set_executor_policy(executor_ptr_type aex) { set_executor(); - ex = aex; + ex_ = aex; } void set_executor_policy(executor_ptr_type aex, boost::lock_guard&) { set_executor(); - ex = aex; + ex_ = aex; } void set_executor_policy(executor_ptr_type aex, boost::unique_lock&) { set_executor(); - ex = aex; + ex_ = aex; } bool valid(boost::unique_lock&) { return is_valid_; } @@ -1006,10 +1006,8 @@ namespace boost template struct future_deferred_shared_state: shared_state { - typedef shared_state base_type; Fp func_; - public: explicit future_deferred_shared_state(BOOST_THREAD_FWD_REF(Fp) f) : func_(boost::move(f)) { @@ -1034,10 +1032,8 @@ namespace boost template struct future_deferred_shared_state: shared_state { - typedef shared_state base_type; Fp func_; - public: explicit future_deferred_shared_state(BOOST_THREAD_FWD_REF(Fp) f) : func_(boost::move(f)) { @@ -1059,10 +1055,8 @@ namespace boost template struct future_deferred_shared_state: shared_state { - typedef shared_state base_type; Fp func_; - public: explicit future_deferred_shared_state(BOOST_THREAD_FWD_REF(Fp) f) : func_(boost::move(f)) { @@ -1090,7 +1084,6 @@ namespace boost public: typedef std::vector::size_type count_type; private: - struct registered_waiter; struct registered_waiter { boost::shared_ptr future_; @@ -2241,13 +2234,13 @@ namespace boost void lazy_init() { #if defined BOOST_THREAD_PROVIDES_PROMISE_LAZY -#include +#include if(!atomic_load(&future_)) { future_ptr blank; atomic_compare_exchange(&future_,&blank,future_ptr(new detail::shared_state)); } -#include +#include #endif } @@ -2532,13 +2525,13 @@ namespace boost void lazy_init() { #if defined BOOST_THREAD_PROVIDES_PROMISE_LAZY -#include +#include if(!atomic_load(&future_)) { future_ptr blank; atomic_compare_exchange(&future_,&blank,future_ptr(new detail::shared_state)); } -#include +#include #endif } @@ -4959,6 +4952,10 @@ namespace detail { return BOOST_THREAD_MAKE_RV_REF((boost::detail::make_future_deferred_continuation_shared_state, future_type>( lock, boost::move(*this), boost::forward(func) ))); + } else if (underlying_cast(policy) & int(launch::sync)) { + return BOOST_THREAD_MAKE_RV_REF((boost::detail::make_future_sync_continuation_shared_state, future_type>( + lock, boost::move(*this), boost::forward(func) + ))); #ifdef BOOST_THREAD_PROVIDES_EXECUTORS } else if (underlying_cast(policy) & int(launch::executor)) { assert(this->future_->get_executor()); @@ -4979,6 +4976,10 @@ namespace detail { return BOOST_THREAD_MAKE_RV_REF((boost::detail::make_future_deferred_continuation_shared_state, future_type>( lock, boost::move(*this), boost::forward(func) ))); + } else if (underlying_cast(policy_) & int(launch::sync)) { + return BOOST_THREAD_MAKE_RV_REF((boost::detail::make_future_sync_continuation_shared_state, future_type>( + lock, boost::move(*this), boost::forward(func) + ))); #ifdef BOOST_THREAD_PROVIDES_EXECUTORS } else if (underlying_cast(policy_) & int(launch::executor)) { assert(this->future_->get_executor()); diff --git a/include/boost/thread/win32/basic_recursive_mutex.hpp b/include/boost/thread/win32/basic_recursive_mutex.hpp index 5194bb29..6913c5bf 100644 --- a/include/boost/thread/win32/basic_recursive_mutex.hpp +++ b/include/boost/thread/win32/basic_recursive_mutex.hpp @@ -4,7 +4,7 @@ // basic_recursive_mutex.hpp // // (C) Copyright 2006-8 Anthony Williams -// (C) Copyright 2011-2012 Vicente J. Botet Escriba +// (C) Copyright 2011-2012,2017-2018 Vicente J. Botet Escriba // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -44,13 +44,13 @@ namespace boost bool try_lock() BOOST_NOEXCEPT { - long const current_thread_id=boost::detail::winapi::GetCurrentThreadId(); + long const current_thread_id=boost::winapi::GetCurrentThreadId(); return try_recursive_lock(current_thread_id) || try_basic_lock(current_thread_id); } void lock() { - long const current_thread_id=boost::detail::winapi::GetCurrentThreadId(); + long const current_thread_id=boost::winapi::GetCurrentThreadId(); if(!try_recursive_lock(current_thread_id)) { mutex.lock(); @@ -61,7 +61,7 @@ namespace boost #if defined BOOST_THREAD_USES_DATETIME bool timed_lock(::boost::system_time const& target) { - long const current_thread_id=boost::detail::winapi::GetCurrentThreadId(); + long const current_thread_id=boost::winapi::GetCurrentThreadId(); return try_recursive_lock(current_thread_id) || try_timed_lock(current_thread_id,target); } template diff --git a/include/boost/thread/win32/condition_variable.hpp b/include/boost/thread/win32/condition_variable.hpp index 6b29ab42..d17d76c5 100644 --- a/include/boost/thread/win32/condition_variable.hpp +++ b/include/boost/thread/win32/condition_variable.hpp @@ -77,7 +77,7 @@ namespace boost void release(unsigned count_to_release) { notified=true; - detail::winapi::ReleaseSemaphore(semaphore,count_to_release,0); + winapi::ReleaseSemaphore(semaphore,count_to_release,0); } void release_waiters() @@ -97,7 +97,7 @@ namespace boost bool woken() { - unsigned long const woken_result=detail::winapi::WaitForSingleObjectEx(wake_sem,0,0); + unsigned long const woken_result=winapi::WaitForSingleObjectEx(wake_sem,0,0); BOOST_ASSERT((woken_result==detail::win32::timeout) || (woken_result==0)); return woken_result==0; } @@ -136,7 +136,7 @@ namespace boost void wake_waiters(long count_to_wake) { detail::interlocked_write_release(&total_count,total_count-count_to_wake); - detail::winapi::ReleaseSemaphore(wake_sem,count_to_wake,0); + winapi::ReleaseSemaphore(wake_sem,count_to_wake,0); } template diff --git a/include/boost/thread/win32/once.hpp b/include/boost/thread/win32/once.hpp index e7c565fb..56d684cc 100644 --- a/include/boost/thread/win32/once.hpp +++ b/include/boost/thread/win32/once.hpp @@ -136,9 +136,9 @@ namespace boost } #ifdef BOOST_NO_ANSI_APIS - return ::boost::detail::winapi::OpenEventW( + return ::boost::winapi::OpenEventW( #else - return ::boost::detail::winapi::OpenEventA( + return ::boost::winapi::OpenEventA( #endif ::boost::detail::win32::synchronize | ::boost::detail::win32::event_modify_state, @@ -186,7 +186,7 @@ namespace boost } if(ctx.event_handle) { - ::boost::detail::winapi::ResetEvent(ctx.event_handle); + ::boost::winapi::ResetEvent(ctx.event_handle); } return true; } @@ -207,7 +207,7 @@ namespace boost } if(ctx.event_handle) { - ::boost::detail::winapi::SetEvent(ctx.event_handle); + ::boost::winapi::SetEvent(ctx.event_handle); } } inline void rollback_once_region(once_flag& flag, once_context& ctx) BOOST_NOEXCEPT @@ -219,7 +219,7 @@ namespace boost } if(ctx.event_handle) { - ::boost::detail::winapi::SetEvent(ctx.event_handle); + ::boost::winapi::SetEvent(ctx.event_handle); } } } @@ -264,7 +264,7 @@ namespace boost continue; } } - BOOST_VERIFY(!::boost::detail::winapi::WaitForSingleObjectEx( + BOOST_VERIFY(!::boost::winapi::WaitForSingleObjectEx( ctx.event_handle,::boost::detail::win32::infinite, 0)); } } @@ -308,7 +308,7 @@ namespace boost continue; } } - BOOST_VERIFY(!::boost::detail::winapi::WaitForSingleObjectEx( + BOOST_VERIFY(!::boost::winapi::WaitForSingleObjectEx( ctx.event_handle,::boost::detail::win32::infinite,0)); } } @@ -355,7 +355,7 @@ namespace boost continue; } } - BOOST_VERIFY(!::boost::detail::winapi::WaitForSingleObjectEx( + BOOST_VERIFY(!::boost::winapi::WaitForSingleObjectEx( ctx.event_handle,::boost::detail::win32::infinite,0)); } } @@ -400,7 +400,7 @@ namespace boost continue; } } - BOOST_VERIFY(!::boost::detail::winapi::WaitForSingleObjectEx( + BOOST_VERIFY(!::boost::winapi::WaitForSingleObjectEx( ctx.event_handle,::boost::detail::win32::infinite,0)); } } @@ -443,7 +443,7 @@ namespace boost continue; } } - BOOST_VERIFY(!::boost::detail::winapi::WaitForSingleObjectEx( + BOOST_VERIFY(!::boost::winapi::WaitForSingleObjectEx( ctx.event_handle,::boost::detail::win32::infinite,0)); } } @@ -486,7 +486,7 @@ namespace boost continue; } } - BOOST_VERIFY(!::boost::detail::winapi::WaitForSingleObjectEx( + BOOST_VERIFY(!::boost::winapi::WaitForSingleObjectEx( ctx.event_handle,::boost::detail::win32::infinite,0)); } } @@ -529,7 +529,7 @@ namespace boost continue; } } - BOOST_VERIFY(!::boost::detail::winapi::WaitForSingleObjectEx( + BOOST_VERIFY(!::boost::winapi::WaitForSingleObjectEx( ctx.event_handle,::boost::detail::win32::infinite,0)); } } @@ -574,7 +574,7 @@ namespace boost continue; } } - BOOST_VERIFY(!::boost::detail::winapi::WaitForSingleObjectEx( + BOOST_VERIFY(!::boost::winapi::WaitForSingleObjectEx( ctx.event_handle,::boost::detail::win32::infinite,0)); } } @@ -617,7 +617,7 @@ namespace boost continue; } } - BOOST_VERIFY(!::boost::detail::winapi::WaitForSingleObjectEx( + BOOST_VERIFY(!::boost::winapi::WaitForSingleObjectEx( ctx.event_handle,::boost::detail::win32::infinite,0)); } } @@ -660,7 +660,7 @@ namespace boost continue; } } - BOOST_VERIFY(!::boost::detail::winapi::WaitForSingleObjectEx( + BOOST_VERIFY(!::boost::winapi::WaitForSingleObjectEx( ctx.event_handle,::boost::detail::win32::infinite,0)); } } @@ -703,7 +703,7 @@ namespace boost continue; } } - BOOST_VERIFY(!::boost::detail::winapi::WaitForSingleObjectEx( + BOOST_VERIFY(!::boost::winapi::WaitForSingleObjectEx( ctx.event_handle,::boost::detail::win32::infinite,0)); } } @@ -748,7 +748,7 @@ namespace boost continue; } } - BOOST_VERIFY(!::boost::detail::winapi::WaitForSingleObjectEx( + BOOST_VERIFY(!::boost::winapi::WaitForSingleObjectEx( ctx.event_handle,::boost::detail::win32::infinite,0)); } } @@ -793,7 +793,7 @@ namespace boost continue; } } - BOOST_VERIFY(!::boost::detail::winapi::WaitForSingleObjectEx( + BOOST_VERIFY(!::boost::winapi::WaitForSingleObjectEx( ctx.event_handle,::boost::detail::win32::infinite,0)); } } @@ -839,7 +839,7 @@ namespace boost continue; } } - BOOST_VERIFY(!::boost::detail::winapi::WaitForSingleObjectEx( + BOOST_VERIFY(!::boost::winapi::WaitForSingleObjectEx( ctx.event_handle,::boost::detail::win32::infinite,0)); } } @@ -886,7 +886,7 @@ namespace boost continue; } } - BOOST_VERIFY(!::boost::detail::winapi::WaitForSingleObjectEx( + BOOST_VERIFY(!::boost::winapi::WaitForSingleObjectEx( ctx.event_handle,::boost::detail::win32::infinite,0)); } } @@ -930,7 +930,7 @@ namespace boost continue; } } - BOOST_VERIFY(!::boost::detail::winapi::WaitForSingleObjectEx( + BOOST_VERIFY(!::boost::winapi::WaitForSingleObjectEx( ctx.event_handle,::boost::detail::win32::infinite,0)); } } @@ -977,7 +977,7 @@ namespace boost continue; } } - BOOST_VERIFY(!::boost::detail::winapi::WaitForSingleObjectEx( + BOOST_VERIFY(!::boost::winapi::WaitForSingleObjectEx( ctx.event_handle,::boost::detail::win32::infinite,0)); } } @@ -1024,7 +1024,7 @@ namespace boost continue; } } - BOOST_VERIFY(!::boost::detail::winapi::WaitForSingleObjectEx( + BOOST_VERIFY(!::boost::winapi::WaitForSingleObjectEx( ctx.event_handle,::boost::detail::win32::infinite,0)); } } @@ -1073,7 +1073,7 @@ namespace boost continue; } } - BOOST_VERIFY(!::boost::detail::winapi::WaitForSingleObjectEx( + BOOST_VERIFY(!::boost::winapi::WaitForSingleObjectEx( ctx.event_handle,::boost::detail::win32::infinite,0)); } } diff --git a/include/boost/thread/win32/shared_mutex.hpp b/include/boost/thread/win32/shared_mutex.hpp index 012966f4..85bf1d0f 100644 --- a/include/boost/thread/win32/shared_mutex.hpp +++ b/include/boost/thread/win32/shared_mutex.hpp @@ -2,7 +2,7 @@ #define BOOST_THREAD_WIN32_SHARED_MUTEX_HPP // (C) Copyright 2006-8 Anthony Williams -// (C) Copyright 2011-2012 Vicente J. Botet Escriba +// (C) Copyright 2011-2012,2017-2018 Vicente J. Botet Escriba // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -65,19 +65,19 @@ namespace boost { if(old_state.exclusive_waiting) { - BOOST_VERIFY(detail::winapi::ReleaseSemaphore(semaphores[exclusive_sem],1,0)!=0); + BOOST_VERIFY(winapi::ReleaseSemaphore(semaphores[exclusive_sem],1,0)!=0); } if(old_state.shared_waiting || old_state.exclusive_waiting) { - BOOST_VERIFY(detail::winapi::ReleaseSemaphore(semaphores[unlock_sem],old_state.shared_waiting + (old_state.exclusive_waiting?1:0),0)!=0); + BOOST_VERIFY(winapi::ReleaseSemaphore(semaphores[unlock_sem],old_state.shared_waiting + (old_state.exclusive_waiting?1:0),0)!=0); } } void release_shared_waiters(state_data old_state) { if(old_state.shared_waiting || old_state.exclusive_waiting) { - BOOST_VERIFY(detail::winapi::ReleaseSemaphore(semaphores[unlock_sem],old_state.shared_waiting + (old_state.exclusive_waiting?1:0),0)!=0); + BOOST_VERIFY(winapi::ReleaseSemaphore(semaphores[unlock_sem],old_state.shared_waiting + (old_state.exclusive_waiting?1:0),0)!=0); } } @@ -105,9 +105,9 @@ namespace boost ~shared_mutex() { - detail::winapi::CloseHandle(upgrade_sem); - detail::winapi::CloseHandle(semaphores[unlock_sem]); - detail::winapi::CloseHandle(semaphores[exclusive_sem]); + winapi::CloseHandle(upgrade_sem); + winapi::CloseHandle(semaphores[unlock_sem]); + winapi::CloseHandle(semaphores[exclusive_sem]); } bool try_lock_shared() @@ -173,7 +173,7 @@ namespace boost return; } - BOOST_VERIFY(detail::winapi::WaitForSingleObjectEx(semaphores[unlock_sem],::boost::detail::win32::infinite,0)==0); + BOOST_VERIFY(winapi::WaitForSingleObjectEx(semaphores[unlock_sem],::boost::detail::win32::infinite,0)==0); } } @@ -245,7 +245,7 @@ namespace boost { d = (std::min)(d, max); } - res=detail::winapi::WaitForSingleObjectEx(semaphores[unlock_sem],getMs(d),0); + res=winapi::WaitForSingleObjectEx(semaphores[unlock_sem],getMs(d),0); if(res!=detail::win32::timeout) // semaphore released { break; @@ -366,7 +366,7 @@ namespace boost { if(old_state.upgrade) { - BOOST_VERIFY(detail::winapi::ReleaseSemaphore(upgrade_sem,1,0)!=0); + BOOST_VERIFY(winapi::ReleaseSemaphore(upgrade_sem,1,0)!=0); } else { @@ -445,7 +445,7 @@ namespace boost #else const bool wait_all = false; #endif - BOOST_VERIFY(detail::winapi::WaitForMultipleObjectsEx(2,semaphores,wait_all,::boost::detail::win32::infinite,0)<2); + BOOST_VERIFY(winapi::WaitForMultipleObjectsEx(2,semaphores,wait_all,::boost::detail::win32::infinite,0)<2); } } @@ -505,10 +505,12 @@ namespace boost d = (std::min)(d, max); } #ifndef UNDER_CE - wait_res=detail::winapi::WaitForMultipleObjectsEx(2,semaphores,true,getMs(d),0); + wait_res=winapi::WaitForMultipleObjectsEx(2,semaphores,true,getMs(d),0); #else - wait_res=detail::winapi::WaitForMultipleObjectsEx(2,semaphores,false,getMs(d),0); + wait_res=winapi::WaitForMultipleObjectsEx(2,semaphores,false,getMs(d),0); #endif + //wait_res=winapi::WaitForMultipleObjectsEx(2,semaphores,wait_all,getMs(d), 0); + if(wait_res!=detail::win32::timeout) // semaphore released { break; @@ -540,7 +542,7 @@ namespace boost state_data const current_state=interlocked_compare_exchange(&state,new_state,old_state); if (must_notify) { - BOOST_VERIFY(detail::winapi::ReleaseSemaphore(semaphores[unlock_sem],1,0)!=0); + BOOST_VERIFY(winapi::ReleaseSemaphore(semaphores[unlock_sem],1,0)!=0); } if(current_state==old_state) @@ -663,7 +665,7 @@ namespace boost return; } - BOOST_VERIFY(detail::winapi::WaitForSingleObjectEx(semaphores[unlock_sem],detail::winapi::infinite,0)==0); + BOOST_VERIFY(winapi::WaitForSingleObjectEx(semaphores[unlock_sem],winapi::infinite,0)==0); } } @@ -755,7 +757,7 @@ namespace boost { if(!last_reader) { - BOOST_VERIFY(detail::winapi::WaitForSingleObjectEx(upgrade_sem,detail::win32::infinite,0)==0); + BOOST_VERIFY(winapi::WaitForSingleObjectEx(upgrade_sem,detail::win32::infinite,0)==0); } break; } diff --git a/include/boost/thread/win32/thread_data.hpp b/include/boost/thread/win32/thread_data.hpp index b1e0425f..85acbd0b 100644 --- a/include/boost/thread/win32/thread_data.hpp +++ b/include/boost/thread/win32/thread_data.hpp @@ -154,7 +154,7 @@ namespace boost #if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS void interrupt() { - BOOST_VERIFY(detail::winapi::SetEvent(interruption_handle)!=0); + BOOST_VERIFY(winapi::SetEvent(interruption_handle)!=0); } #endif typedef detail::win32::handle native_handle_type; diff --git a/include/boost/thread/win32/thread_heap_alloc.hpp b/include/boost/thread/win32/thread_heap_alloc.hpp index 96621355..176d269e 100644 --- a/include/boost/thread/win32/thread_heap_alloc.hpp +++ b/include/boost/thread/win32/thread_heap_alloc.hpp @@ -12,7 +12,7 @@ #include #include -#include +#include #include @@ -22,7 +22,7 @@ namespace boost { inline void* allocate_raw_heap_memory(unsigned size) { - void* const heap_memory=detail::winapi::HeapAlloc(detail::winapi::GetProcessHeap(),0,size); + void* const heap_memory=winapi::HeapAlloc(winapi::GetProcessHeap(),0,size); if(!heap_memory) { boost::throw_exception(std::bad_alloc()); @@ -32,7 +32,7 @@ namespace boost inline void free_raw_heap_memory(void* heap_memory) { - BOOST_VERIFY(detail::winapi::HeapFree(detail::winapi::GetProcessHeap(),0,heap_memory)!=0); + BOOST_VERIFY(winapi::HeapFree(winapi::GetProcessHeap(),0,heap_memory)!=0); } #if defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD) && ! defined (BOOST_NO_CXX11_RVALUE_REFERENCES) template diff --git a/include/boost/thread/win32/thread_primitives.hpp b/include/boost/thread/win32/thread_primitives.hpp index f93cc243..c9abc44f 100644 --- a/include/boost/thread/win32/thread_primitives.hpp +++ b/include/boost/thread/win32/thread_primitives.hpp @@ -16,23 +16,23 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -//#include +//#include #include #include @@ -46,20 +46,20 @@ namespace boost { namespace win32 { - typedef ::boost::detail::winapi::HANDLE_ handle; - typedef ::boost::detail::winapi::SYSTEM_INFO_ system_info; + typedef ::boost::winapi::HANDLE_ handle; + typedef ::boost::winapi::SYSTEM_INFO_ system_info; typedef unsigned __int64 ticks_type; - typedef ::boost::detail::winapi::FARPROC_ farproc_t; - unsigned const infinite=::boost::detail::winapi::INFINITE_; - unsigned const timeout=::boost::detail::winapi::WAIT_TIMEOUT_; - handle const invalid_handle_value=::boost::detail::winapi::INVALID_HANDLE_VALUE_; - unsigned const event_modify_state=::boost::detail::winapi::EVENT_MODIFY_STATE_; - unsigned const synchronize=::boost::detail::winapi::SYNCHRONIZE_; - unsigned const wait_abandoned=::boost::detail::winapi::WAIT_ABANDONED_; + typedef ::boost::winapi::FARPROC_ farproc_t; + unsigned const infinite=::boost::winapi::INFINITE_; + unsigned const timeout=::boost::winapi::WAIT_TIMEOUT_; + handle const invalid_handle_value=::boost::winapi::INVALID_HANDLE_VALUE_; + unsigned const event_modify_state=::boost::winapi::EVENT_MODIFY_STATE_; + unsigned const synchronize=::boost::winapi::SYNCHRONIZE_; + unsigned const wait_abandoned=::boost::winapi::WAIT_ABANDONED_; unsigned const create_event_initial_set = 0x00000002; unsigned const create_event_manual_reset = 0x00000001; - unsigned const event_all_access = ::boost::detail::winapi::EVENT_ALL_ACCESS_; - unsigned const semaphore_all_access = boost::detail::winapi::SEMAPHORE_ALL_ACCESS_; + unsigned const event_all_access = ::boost::winapi::EVENT_ALL_ACCESS_; + unsigned const semaphore_all_access = boost::winapi::SEMAPHORE_ALL_ACCESS_; } } } @@ -94,7 +94,7 @@ namespace boost ticks_type current_tick64; previous_count = (unsigned long) boost::detail::interlocked_read_acquire(&count); - current_tick32 = ::boost::detail::winapi::GetTickCount(); + current_tick32 = ::boost::winapi::GetTickCount(); if(previous_count == (unsigned long)-1l) { @@ -146,13 +146,13 @@ namespace boost // GetTickCount and GetModuleHandle are not allowed in the Windows Runtime, // and kernel32 isn't used in Windows Phone. #if BOOST_PLAT_WINDOWS_RUNTIME - gettickcount64impl = &::boost::detail::winapi::GetTickCount64; + gettickcount64impl = &::boost::winapi::GetTickCount64; #else farproc_t addr=GetProcAddress( #if !defined(BOOST_NO_ANSI_APIS) - ::boost::detail::winapi::GetModuleHandleA("KERNEL32.DLL"), + ::boost::winapi::GetModuleHandleA("KERNEL32.DLL"), #else - ::boost::detail::winapi::GetModuleHandleW(L"KERNEL32.DLL"), + ::boost::winapi::GetModuleHandleW(L"KERNEL32.DLL"), #endif "GetTickCount64"); if(addr) @@ -185,11 +185,11 @@ namespace boost initial_event_state state) { #if !defined(BOOST_NO_ANSI_APIS) - handle const res = ::boost::detail::winapi::CreateEventA(0, type, state, mutex_name); + handle const res = ::boost::winapi::CreateEventA(0, type, state, mutex_name); #elif BOOST_USE_WINAPI_VERSION < BOOST_WINAPI_VERSION_VISTA - handle const res = ::boost::detail::winapi::CreateEventW(0, type, state, mutex_name); + handle const res = ::boost::winapi::CreateEventW(0, type, state, mutex_name); #else - handle const res = ::boost::detail::winapi::CreateEventExW( + handle const res = ::boost::winapi::CreateEventExW( 0, mutex_name, type ? create_event_manual_reset : 0 | state ? create_event_initial_set : 0, @@ -211,12 +211,12 @@ namespace boost inline handle create_anonymous_semaphore_nothrow(long initial_count,long max_count) { #if !defined(BOOST_NO_ANSI_APIS) - handle const res=::boost::detail::winapi::CreateSemaphoreA(0,initial_count,max_count,0); + handle const res=::boost::winapi::CreateSemaphoreA(0,initial_count,max_count,0); #else #if BOOST_USE_WINAPI_VERSION < BOOST_WINAPI_VERSION_VISTA - handle const res=::boost::detail::winapi::CreateSemaphoreEx(0,initial_count,max_count,0,0); + handle const res=::boost::winapi::CreateSemaphoreEx(0,initial_count,max_count,0,0); #else - handle const res=::boost::detail::winapi::CreateSemaphoreExW(0,initial_count,max_count,0,0,semaphore_all_access); + handle const res=::boost::winapi::CreateSemaphoreExW(0,initial_count,max_count,0,0,semaphore_all_access); #endif #endif return res; @@ -234,10 +234,10 @@ namespace boost inline handle duplicate_handle(handle source) { - handle const current_process=::boost::detail::winapi::GetCurrentProcess(); + handle const current_process=::boost::winapi::GetCurrentProcess(); long const same_access_flag=2; handle new_handle=0; - bool const success=::boost::detail::winapi::DuplicateHandle(current_process,source,current_process,&new_handle,0,false,same_access_flag)!=0; + bool const success=::boost::winapi::DuplicateHandle(current_process,source,current_process,&new_handle,0,false,same_access_flag)!=0; if(!success) { boost::throw_exception(thread_resource_error()); @@ -247,15 +247,15 @@ namespace boost inline void release_semaphore(handle semaphore,long count) { - BOOST_VERIFY(::boost::detail::winapi::ReleaseSemaphore(semaphore,count,0)!=0); + BOOST_VERIFY(::boost::winapi::ReleaseSemaphore(semaphore,count,0)!=0); } inline void get_system_info(system_info *info) { #if BOOST_PLAT_WINDOWS_RUNTIME - ::boost::detail::winapi::GetNativeSystemInfo(info); + ::boost::winapi::GetNativeSystemInfo(info); #else - ::boost::detail::winapi::GetSystemInfo(info); + ::boost::winapi::GetSystemInfo(info); #endif } @@ -266,15 +266,15 @@ namespace boost #if BOOST_PLAT_WINDOWS_RUNTIME std::this_thread::yield(); #else - ::boost::detail::winapi::Sleep(0); + ::boost::winapi::Sleep(0); #endif } else { #if BOOST_PLAT_WINDOWS_RUNTIME - ::boost::detail::winapi::WaitForSingleObjectEx(::boost::detail::winapi::GetCurrentThread(), milliseconds, 0); + ::boost::winapi::WaitForSingleObjectEx(::boost::winapi::GetCurrentThread(), milliseconds, 0); #else - ::boost::detail::winapi::Sleep(milliseconds); + ::boost::winapi::Sleep(milliseconds); #endif } } @@ -290,7 +290,7 @@ namespace boost { if (m_completionHandle != ::boost::detail::win32::invalid_handle_value) { - ::boost::detail::winapi::CloseHandle(m_completionHandle); + ::boost::winapi::CloseHandle(m_completionHandle); } } @@ -318,7 +318,7 @@ namespace boost { if(handle_to_manage && handle_to_manage!=invalid_handle_value) { - BOOST_VERIFY(::boost::detail::winapi::CloseHandle(handle_to_manage)); + BOOST_VERIFY(::boost::winapi::CloseHandle(handle_to_manage)); } } diff --git a/src/pthread/thread.cpp b/src/pthread/thread.cpp index aa1652cf..1be5bae2 100644 --- a/src/pthread/thread.cpp +++ b/src/pthread/thread.cpp @@ -27,6 +27,10 @@ #include #endif +#if defined(__VXWORKS__) +#include +#endif + #include #include #include @@ -485,6 +489,18 @@ namespace boost #elif defined(BOOST_HAS_UNISTD_H) && defined(_SC_NPROCESSORS_ONLN) int const count=sysconf(_SC_NPROCESSORS_ONLN); return (count>0)?count:0; +#elif defined(__VXWORKS__) + cpuset_t set = ::vxCpuEnabledGet(); + #ifdef __DCC__ + int i; + for( i = 0; set; ++i) + { + set &= set -1; + } + return(i); + #else + return (__builtin_popcount(set) ); + #endif #elif defined(__GLIBC__) return get_nprocs(); #else diff --git a/src/win32/thread.cpp b/src/win32/thread.cpp index 84599bb1..53a4ce6a 100644 --- a/src/win32/thread.cpp +++ b/src/win32/thread.cpp @@ -3,11 +3,11 @@ // http://www.boost.org/LICENSE_1_0.txt) // (C) Copyright 2007 Anthony Williams // (C) Copyright 2007 David Deakins -// (C) Copyright 2011-2017 Vicente J. Botet Escriba +// (C) Copyright 2011-2018 Vicente J. Botet Escriba //#define BOOST_THREAD_VERSION 3 -#include +#include #include #include #include @@ -492,7 +492,7 @@ namespace boost bool thread::interruption_requested() const BOOST_NOEXCEPT { detail::thread_data_ptr local_thread_info=(get_thread_info)(); - return local_thread_info.get() && (detail::winapi::WaitForSingleObjectEx(local_thread_info->interruption_handle,0,0)==0); + return local_thread_info.get() && (winapi::WaitForSingleObjectEx(local_thread_info->interruption_handle,0,0)==0); } #endif @@ -671,7 +671,7 @@ namespace boost { if(handle_count) { - unsigned long const notified_index=detail::winapi::WaitForMultipleObjectsEx(handle_count,handles,false,static_cast(time_left_msec), 0); + unsigned long const notified_index=winapi::WaitForMultipleObjectsEx(handle_count,handles,false,static_cast(time_left_msec), 0); if(notified_indexinterruption_handle); + winapi::ResetEvent(detail::get_current_thread_data()->interruption_handle); throw thread_interrupted(); } #endif @@ -763,7 +763,7 @@ namespace boost { if(handle_count) { - unsigned long const notified_index=detail::winapi::WaitForMultipleObjectsEx(handle_count,handles,false,static_cast(time_left_msec), 0); + unsigned long const notified_index=winapi::WaitForMultipleObjectsEx(handle_count,handles,false,static_cast(time_left_msec), 0); if(notified_indexid; } #endif - return detail::winapi::GetCurrentThreadId(); + return winapi::GetCurrentThreadId(); #else return thread::id(get_or_make_current_thread_data()); #endif @@ -812,7 +812,7 @@ namespace boost { if(interruption_enabled() && interruption_requested()) { - detail::winapi::ResetEvent(detail::get_current_thread_data()->interruption_handle); + winapi::ResetEvent(detail::get_current_thread_data()->interruption_handle); throw thread_interrupted(); } } @@ -824,7 +824,7 @@ namespace boost bool interruption_requested() BOOST_NOEXCEPT { - return detail::get_current_thread_data() && (detail::winapi::WaitForSingleObjectEx(detail::get_current_thread_data()->interruption_handle,0,0)==0); + return detail::get_current_thread_data() && (winapi::WaitForSingleObjectEx(detail::get_current_thread_data()->interruption_handle,0,0)==0); } #endif diff --git a/src/win32/tss_dll.cpp b/src/win32/tss_dll.cpp index cd71933c..75ea93a5 100644 --- a/src/win32/tss_dll.cpp +++ b/src/win32/tss_dll.cpp @@ -3,7 +3,7 @@ // 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 +#include #include diff --git a/src/win32/tss_pe.cpp b/src/win32/tss_pe.cpp index a5d258cd..e4a0a3aa 100644 --- a/src/win32/tss_pe.cpp +++ b/src/win32/tss_pe.cpp @@ -7,7 +7,7 @@ // 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 +#include #include #if defined(BOOST_HAS_WINTHREADS) && defined(BOOST_THREAD_BUILD_LIB) diff --git a/test/test_generic_locks.cpp b/test/test_generic_locks.cpp index 22aed6e6..0a9befcf 100644 --- a/test/test_generic_locks.cpp +++ b/test/test_generic_locks.cpp @@ -12,6 +12,8 @@ #include #include #include +#include +#include BOOST_AUTO_TEST_CASE(test_lock_two_uncontended) { @@ -300,13 +302,17 @@ BOOST_AUTO_TEST_CASE(test_lock_five_in_range) } } -class dummy_iterator: - public std::iterator +class dummy_iterator { private: dummy_mutex* p; public: + typedef std::forward_iterator_tag iterator_category; + typedef dummy_mutex value_type; + typedef std::ptrdiff_t difference_type; + typedef dummy_mutex* pointer; + typedef dummy_mutex& reference; + explicit dummy_iterator(dummy_mutex* p_): p(p_) {} diff --git a/test/test_lock_concept.cpp b/test/test_lock_concept.cpp index 78e70120..ba7de5cd 100644 --- a/test/test_lock_concept.cpp +++ b/test/test_lock_concept.cpp @@ -440,8 +440,8 @@ void test_lock_is_scoped_lock_concept_for_mutex() test_unlocked_after_try_lock_if_other_thread_has_lock()(); } -typedef boost::mpl::vector mutex_types_with_scoped_lock; +typedef boost::mpl::vector mutex_types_with_scoped_lock; BOOST_AUTO_TEST_CASE_TEMPLATE(test_scoped_lock_concept,Mutex,mutex_types_with_scoped_lock) { @@ -450,8 +450,8 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(test_scoped_lock_concept,Mutex,mutex_types_with_sc test_lock_is_scoped_lock_concept_for_mutex(); } -typedef boost::mpl::vector all_mutex_types; +typedef boost::mpl::vector all_mutex_types; BOOST_AUTO_TEST_CASE_TEMPLATE(test_unique_lock_is_scoped_lock,Mutex,all_mutex_types) {