diff --git a/doc/sync_tutorial.qbk b/doc/sync_tutorial.qbk index dd4002c7..0765dcb1 100644 --- a/doc/sync_tutorial.qbk +++ b/doc/sync_tutorial.qbk @@ -7,8 +7,10 @@ [section:tutorial Tutorial] + [@http://web.archive.org/web/20140531071228/http://home.roadrunner.com/~hinnant/mutexes/locking.html Handling mutexes in C++] is an excellent tutorial. You need just replace std and ting by boost. + [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2406.html Mutex, Lock, Condition Variable Rationale] adds rationale for the design decisions made for mutexes, locks and condition variables. diff --git a/example/executor.cpp b/example/executor.cpp index fae3e9e5..67baeaeb 100644 --- a/example/executor.cpp +++ b/example/executor.cpp @@ -234,7 +234,7 @@ int main() { return test_executor_adaptor(); -#if defined BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION \ +#if 0 && defined BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION \ && defined BOOST_THREAD_PROVIDES_EXECUTORS \ && ! defined BOOST_NO_CXX11_RVALUE_REFERENCES diff --git a/example/future_when_all.cpp b/example/future_when_all.cpp index b467acb0..48f3e153 100644 --- a/example/future_when_all.cpp +++ b/example/future_when_all.cpp @@ -58,6 +58,8 @@ int p2(boost::future f) } BOOST_THREAD_LOG << "P2>" << BOOST_THREAD_END_LOG; + return 0; + } int p2s(boost::shared_future f) { @@ -81,6 +83,7 @@ int p2s(boost::shared_future f) } BOOST_THREAD_LOG << "P2>" << BOOST_THREAD_END_LOG; + return 0; } int main() diff --git a/example/tennis.cpp b/example/tennis.cpp index 0212f677..61d49b27 100644 --- a/example/tennis.cpp +++ b/example/tennis.cpp @@ -39,7 +39,7 @@ const char* player_name(int state) if (state == PLAYER_B) return "PLAYER-B"; throw "bad player"; - return 0; + //return 0; } void player(int active) diff --git a/example/tss.cpp b/example/tss.cpp index 0b8a2b32..f5f108e1 100644 --- a/example/tss.cpp +++ b/example/tss.cpp @@ -24,6 +24,7 @@ void thread_proc() increment(); int* p = value.get(); assert(*p == i+1); + (void)(p); } } diff --git a/include/boost/thread/concurrent_queues/sync_timed_queue.hpp b/include/boost/thread/concurrent_queues/sync_timed_queue.hpp index 8f24f43e..36223d87 100644 --- a/include/boost/thread/concurrent_queues/sync_timed_queue.hpp +++ b/include/boost/thread/concurrent_queues/sync_timed_queue.hpp @@ -235,7 +235,7 @@ namespace detail if (super::closed(lk)) return true; super::not_empty_.wait(lk); } - return false; + //return false; } /////////////////////////// diff --git a/include/boost/thread/csbl/devector.hpp b/include/boost/thread/csbl/devector.hpp index c11ad29b..c2bc0bbe 100644 --- a/include/boost/thread/csbl/devector.hpp +++ b/include/boost/thread/csbl/devector.hpp @@ -21,8 +21,8 @@ namespace boost template class devector { - typedef vector vector_type; - vector data_; + typedef csbl::vector vector_type; + vector_type data_; std::size_t front_index_; BOOST_COPYABLE_AND_MOVABLE(devector) @@ -58,7 +58,9 @@ namespace boost } devector& operator=(BOOST_RV_REF(devector) x) - BOOST_NOEXCEPT_IF(vector::allocator_traits_type::propagate_on_container_move_assignment::value) +#if defined BOOST_THREAD_USES_BOOST_VECTOR + BOOST_NOEXCEPT_IF(vector_type::allocator_traits_type::propagate_on_container_move_assignment::value) +#endif { data_ = boost::move(x.data_); front_index_ = x.front_index_; diff --git a/include/boost/thread/executors/basic_thread_pool.hpp b/include/boost/thread/executors/basic_thread_pool.hpp index 0c8e282c..66a3cb02 100644 --- a/include/boost/thread/executors/basic_thread_pool.hpp +++ b/include/boost/thread/executors/basic_thread_pool.hpp @@ -83,10 +83,15 @@ namespace executors */ void schedule_one_or_yield() { +#if 1 if ( ! try_executing_one()) { this_thread::yield(); } +#else + std::terminate(); + //return false; +#endif } private: diff --git a/include/boost/thread/executors/loop_executor.hpp b/include/boost/thread/executors/loop_executor.hpp index 058122bb..110cb0ad 100644 --- a/include/boost/thread/executors/loop_executor.hpp +++ b/include/boost/thread/executors/loop_executor.hpp @@ -68,10 +68,15 @@ namespace executors */ void schedule_one_or_yield() { +#if 1 if ( ! try_executing_one()) { this_thread::yield(); } +#else + std::terminate(); + //return false; +#endif } /// loop_executor is not copyable. diff --git a/include/boost/thread/executors/serial_executor.hpp b/include/boost/thread/executors/serial_executor.hpp index 3ad3fadb..9e9b940a 100644 --- a/include/boost/thread/executors/serial_executor.hpp +++ b/include/boost/thread/executors/serial_executor.hpp @@ -106,6 +106,7 @@ namespace executors shared_state(Executor& ex) : ex(ex), thr(&shared_state::worker_thread, this) { + //std::terminate(); } /** * \b Effects: Destroys the thread pool. diff --git a/include/boost/thread/experimental/parallel/v2/task_region.hpp b/include/boost/thread/experimental/parallel/v2/task_region.hpp index 63aad9b0..39570445 100755 --- a/include/boost/thread/experimental/parallel/v2/task_region.hpp +++ b/include/boost/thread/experimental/parallel/v2/task_region.hpp @@ -53,7 +53,7 @@ BOOST_THREAD_INLINE_NAMESPACE(v2) throw; } #if defined BOOST_THREAD_TASK_REGION_HAS_SHARED_CANCELED - catch (task_canceled_exception& ex) + catch (task_canceled_exception&) { } #endif diff --git a/include/boost/thread/future.hpp b/include/boost/thread/future.hpp index 95e824b7..d457ed1d 100644 --- a/include/boost/thread/future.hpp +++ b/include/boost/thread/future.hpp @@ -991,9 +991,10 @@ namespace boost class future_waiter { - struct registered_waiter; + public: typedef std::vector::size_type count_type; - + private: + struct registered_waiter; struct registered_waiter { boost::shared_ptr future_; @@ -1132,7 +1133,7 @@ namespace boost #ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES template - typename boost::enable_if,unsigned>::type wait_for_any(F1& f1,F2& f2) + typename boost::enable_if,typename detail::future_waiter::count_type>::type wait_for_any(F1& f1,F2& f2) { detail::future_waiter waiter; waiter.add(f1); @@ -1141,7 +1142,7 @@ namespace boost } template - unsigned wait_for_any(F1& f1,F2& f2,F3& f3) + typename detail::future_waiter::count_type wait_for_any(F1& f1,F2& f2,F3& f3) { detail::future_waiter waiter; waiter.add(f1); @@ -1151,7 +1152,7 @@ namespace boost } template - unsigned wait_for_any(F1& f1,F2& f2,F3& f3,F4& f4) + typename detail::future_waiter::count_type wait_for_any(F1& f1,F2& f2,F3& f3,F4& f4) { detail::future_waiter waiter; waiter.add(f1); @@ -1162,7 +1163,7 @@ namespace boost } template - unsigned wait_for_any(F1& f1,F2& f2,F3& f3,F4& f4,F5& f5) + typename detail::future_waiter::count_type wait_for_any(F1& f1,F2& f2,F3& f3,F4& f4,F5& f5) { detail::future_waiter waiter; waiter.add(f1); @@ -1174,7 +1175,8 @@ namespace boost } #else template - typename boost::enable_if, unsigned>::type wait_for_any(F1& f1, Fs&... fs) + typename boost::enable_if, typename detail::future_waiter::count_type>::type + wait_for_any(F1& f1, Fs&... fs) { detail::future_waiter waiter; waiter.add(f1, fs...); @@ -3593,8 +3595,8 @@ namespace detail )); } else { std::terminate(); - BOOST_THREAD_FUTURE ret; - return ::boost::move(ret); + //BOOST_THREAD_FUTURE ret; + //return ::boost::move(ret); } } @@ -3617,12 +3619,12 @@ namespace detail return ::boost::move(ret); } else if (underlying_cast(policy) & int(launch::deferred)) { std::terminate(); - BOOST_THREAD_FUTURE ret; - return ::boost::move(ret); + //BOOST_THREAD_FUTURE ret; + //return ::boost::move(ret); } else { std::terminate(); - BOOST_THREAD_FUTURE ret; - return ::boost::move(ret); + //BOOST_THREAD_FUTURE ret; + //return ::boost::move(ret); } } #endif @@ -3657,8 +3659,8 @@ namespace detail )); } else { std::terminate(); - BOOST_THREAD_FUTURE ret; - return ::boost::move(ret); + //BOOST_THREAD_FUTURE ret; + //return ::boost::move(ret); } } @@ -3682,8 +3684,8 @@ namespace detail return ::boost::move(ret); } else if (underlying_cast(policy) & int(launch::deferred)) { std::terminate(); - BOOST_THREAD_FUTURE ret; - return ::boost::move(ret); + //BOOST_THREAD_FUTURE ret; + //return ::boost::move(ret); // return boost::detail::make_future_deferred_shared_state( // BF( // thread_detail::decay_copy(boost::forward(f)) @@ -3691,8 +3693,8 @@ namespace detail // ); } else { std::terminate(); - BOOST_THREAD_FUTURE ret; - return ::boost::move(ret); + //BOOST_THREAD_FUTURE ret; + //return ::boost::move(ret); } } #endif // defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD) diff --git a/include/boost/thread/poly_lockable.hpp b/include/boost/thread/poly_lockable.hpp index 73461881..fffcbce1 100644 --- a/include/boost/thread/poly_lockable.hpp +++ b/include/boost/thread/poly_lockable.hpp @@ -31,7 +31,7 @@ namespace boost //] //[poly_lockable - class poly_lockable : public basic_poly_lockable + class poly_lockable : public basic_poly_lockable { public: @@ -41,7 +41,7 @@ namespace boost //] //[timed_poly_lockable - class timed_poly_lockable: public poly_lockable + class timed_poly_lockable: public poly_lockable { public: virtual ~timed_poly_lockable()=0; diff --git a/include/boost/thread/pthread/once_atomic.hpp b/include/boost/thread/pthread/once_atomic.hpp index 923f07bd..c54a35c5 100644 --- a/include/boost/thread/pthread/once_atomic.hpp +++ b/include/boost/thread/pthread/once_atomic.hpp @@ -214,7 +214,7 @@ namespace boost thread_detail::commit_once_region(flag); } } - +#if !(defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x5130)) template inline void call_once(once_flag& flag, BOOST_THREAD_RV_REF(Function) f) { @@ -302,7 +302,7 @@ namespace boost } } - +#endif // __SUNPRO_CC #endif } diff --git a/include/boost/thread/shared_mutex.hpp b/include/boost/thread/shared_mutex.hpp index b968f2ac..ce5d6d1b 100644 --- a/include/boost/thread/shared_mutex.hpp +++ b/include/boost/thread/shared_mutex.hpp @@ -28,6 +28,7 @@ namespace boost { + typedef shared_mutex shared_timed_mutex; namespace sync { #ifdef BOOST_THREAD_NO_AUTO_DETECT_MUTEX_TYPES diff --git a/include/boost/thread/win32/thread_primitives.hpp b/include/boost/thread/win32/thread_primitives.hpp index d0d4f0ae..b63503ad 100644 --- a/include/boost/thread/win32/thread_primitives.hpp +++ b/include/boost/thread/win32/thread_primitives.hpp @@ -46,7 +46,7 @@ namespace boost unsigned const create_event_manual_reset = 0x00000001; unsigned const event_all_access = EVENT_ALL_ACCESS; unsigned const semaphore_all_access = SEMAPHORE_ALL_ACCESS; - + # ifdef BOOST_NO_ANSI_APIS # if BOOST_USE_WINAPI_VERSION < BOOST_WINAPI_VERSION_VISTA @@ -59,7 +59,7 @@ namespace boost using ::CreateSemaphoreExW; # endif using ::OpenEventW; - using ::GetModuleGandleW; + using ::GetModuleHandleW; # else using ::CreateMutexA; using ::CreateEventA; @@ -79,8 +79,8 @@ namespace boost using ::ReleaseSemaphore; using ::SetEvent; using ::ResetEvent; - using ::WaitForMultipleObjectsEx; - using ::WaitForSingleObjectEx; + using ::WaitForMultipleObjectsEx; + using ::WaitForSingleObjectEx; using ::GetCurrentProcessId; using ::GetCurrentThreadId; using ::GetCurrentThread; @@ -91,7 +91,7 @@ namespace boost using ::Sleep; using ::QueueUserAPC; using ::GetProcAddress; -#endif +#endif } } } @@ -286,7 +286,7 @@ namespace boost } // Oops, we weren't called often enough, we're stuck - return 0xFFFFFFFF; + return 0xFFFFFFFF; } #else #endif @@ -295,12 +295,12 @@ namespace boost static detail::gettickcount64_t gettickcount64impl; if(gettickcount64impl) return gettickcount64impl; - + // GetTickCount and GetModuleHandle are not allowed in the Windows Runtime, // and kernel32 isn't used in Windows Phone. #if BOOST_PLAT_WINDOWS_RUNTIME gettickcount64impl = &GetTickCount64; -#else +#else farproc_t addr=GetProcAddress( #if !defined(BOOST_NO_ANSI_APIS) GetModuleHandleA("KERNEL32.DLL"), @@ -312,7 +312,7 @@ namespace boost gettickcount64impl=(detail::gettickcount64_t) addr; else gettickcount64impl=&GetTickCount64emulation; -#endif +#endif return gettickcount64impl; } @@ -343,14 +343,14 @@ namespace boost handle const res = win32::CreateEventW(0, type, state, mutex_name); #else handle const res = win32::CreateEventExW( - 0, - mutex_name, + 0, + mutex_name, type ? create_event_manual_reset : 0 | state ? create_event_initial_set : 0, event_all_access); #endif return res; } - + inline handle create_anonymous_event(event_type type,initial_event_state state) { handle const res = create_event(0, type, state); @@ -374,7 +374,7 @@ namespace boost #endif return res; } - + inline handle create_anonymous_semaphore(long initial_count,long max_count) { handle const res=create_anonymous_semaphore_nothrow(initial_count,max_count); @@ -402,20 +402,20 @@ namespace boost { BOOST_VERIFY(ReleaseSemaphore(semaphore,count,0)!=0); } - + inline void get_system_info(system_info *info) { #if BOOST_PLAT_WINDOWS_RUNTIME - win32::GetNativeSystemInfo(info); + win32::GetNativeSystemInfo(info); #else win32::GetSystemInfo(info); #endif } - + inline void sleep(unsigned long milliseconds) { if(milliseconds == 0) - { + { #if BOOST_PLAT_WINDOWS_RUNTIME std::this_thread::yield(); #else @@ -425,13 +425,13 @@ namespace boost else { #if BOOST_PLAT_WINDOWS_RUNTIME - ::boost::detail::win32::WaitForSingleObjectEx(::boost::detail::win32::GetCurrentThread(), milliseconds, 0); + ::boost::detail::win32::WaitForSingleObjectEx(::boost::detail::win32::GetCurrentThread(), milliseconds, 0); #else ::boost::detail::win32::Sleep(milliseconds); #endif } } - + #if BOOST_PLAT_WINDOWS_RUNTIME class BOOST_THREAD_DECL scoped_winrt_thread { @@ -639,7 +639,7 @@ namespace boost } old=current; } - while(true); + while(true) ; return (old&value)!=0; } @@ -656,7 +656,7 @@ namespace boost } old=current; } - while(true); + while(true) ; return (old&value)!=0; } } diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 5761c621..1df9f96e 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -962,15 +962,18 @@ rule thread-compile ( sources : reqs * : name ) test-suite ts_ : #[ thread-run test_11256.cpp ] - [ thread-run2 ../example/executor.cpp : ex_executor2 ] - [ thread-run2 ../example/generic_executor_ref.cpp : ex_generic_executor_ref2 ] - [ thread-run2 ../example/generic_executor.cpp : ex_generic_executor2 ] - [ thread-run2 ../example/generic_serial_executor_cont.cpp : ex_generic_serial_executor_cont2 ] - [ thread-run2-noit ./sync/futures/async/async_executor_pass.cpp : async__async_executor_p2 ] - [ thread-run2 ../example/fib_task_region.cpp : ex_fib_task_region2 ] - [ thread-run2-noit ./experimental/parallel/v2/task_region_pass.cpp : task_region_p2 ] - [ thread-run2 ../example/parallel_quick_sort.cpp : ex_parallel_quick_sort2 ] - [ thread-run2 ../example/parallel_accumulate.cpp : ex_parallel_accumulate2 ] + #[ thread-run2 ../example/executor.cpp : ex_executor2 ] + #[ thread-run2 ../example/generic_executor_ref.cpp : ex_generic_executor_ref2 ] + #[ thread-run2 ../example/generic_executor.cpp : ex_generic_executor2 ] + #[ thread-run2 ../example/generic_serial_executor_cont.cpp : ex_generic_serial_executor_cont2 ] + #[ thread-run2-noit ./sync/futures/async/async_executor_pass.cpp : async__async_executor_p2 ] + #[ thread-run2 ../example/fib_task_region.cpp : ex_fib_task_region2 ] + #[ thread-run2-noit ./experimental/parallel/v2/task_region_pass.cpp : task_region_p2 ] + #[ thread-run2 ../example/parallel_quick_sort.cpp : ex_parallel_quick_sort2 ] + #[ thread-run2 ../example/parallel_accumulate.cpp : ex_parallel_accumulate2 ] + #[ thread-run test_11256.cpp ] + #[ thread-run test_11499.cpp ] + [ thread-run test_11611.cpp ] ; diff --git a/test/sync/futures/promise/set_value_at_thread_exit_void_pass.cpp b/test/sync/futures/promise/set_value_at_thread_exit_void_pass.cpp index 81d5afeb..c79f2a23 100644 --- a/test/sync/futures/promise/set_value_at_thread_exit_void_pass.cpp +++ b/test/sync/futures/promise/set_value_at_thread_exit_void_pass.cpp @@ -54,7 +54,7 @@ int main() BOOST_TEST(i == 1); } - catch(std::exception& ex) + catch(std::exception& ) { BOOST_TEST(false); } diff --git a/test/sync/mutual_exclusion/deque_views/single_thread_pass.cpp b/test/sync/mutual_exclusion/deque_views/single_thread_pass.cpp index ec310192..ba9c75b9 100644 --- a/test/sync/mutual_exclusion/deque_views/single_thread_pass.cpp +++ b/test/sync/mutual_exclusion/deque_views/single_thread_pass.cpp @@ -185,7 +185,7 @@ int main() // empty queue try_push lvalue succeeds boost::deque_adaptor > sq; boost::deque_back q(sq); - int i; + int i=0; BOOST_TEST(boost::queue_op_status::success == q.try_push(i)); BOOST_TEST(! q.empty()); BOOST_TEST(! q.full()); diff --git a/test/sync/mutual_exclusion/locks/unique_lock/cons/make_unique_lock_try_to_lock_pass.cpp b/test/sync/mutual_exclusion/locks/unique_lock/cons/make_unique_lock_try_to_lock_pass.cpp index bd7cff13..66f64339 100644 --- a/test/sync/mutual_exclusion/locks/unique_lock/cons/make_unique_lock_try_to_lock_pass.cpp +++ b/test/sync/mutual_exclusion/locks/unique_lock/cons/make_unique_lock_try_to_lock_pass.cpp @@ -74,7 +74,7 @@ void f() } { time_point t0 = Clock::now(); - while (true) + for (;;) { #if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) auto diff --git a/test/sync/mutual_exclusion/queue_views/single_thread_pass.cpp b/test/sync/mutual_exclusion/queue_views/single_thread_pass.cpp index d40c1157..b55f55c7 100644 --- a/test/sync/mutual_exclusion/queue_views/single_thread_pass.cpp +++ b/test/sync/mutual_exclusion/queue_views/single_thread_pass.cpp @@ -185,7 +185,7 @@ int main() // empty queue try_push lvalue succeeds boost::queue_adaptor > sq; boost::queue_back q(sq); - int i; + int i=0; BOOST_TEST(boost::queue_op_status::success == q.try_push(i)); BOOST_TEST(! q.empty()); BOOST_TEST(! q.full()); diff --git a/test/sync/mutual_exclusion/sync_pq/pq_multi_thread_pass.cpp b/test/sync/mutual_exclusion/sync_pq/pq_multi_thread_pass.cpp index d8e82c2e..d0626b98 100644 --- a/test/sync/mutual_exclusion/sync_pq/pq_multi_thread_pass.cpp +++ b/test/sync/mutual_exclusion/sync_pq/pq_multi_thread_pass.cpp @@ -105,7 +105,7 @@ void atomic_pull(sync_pq* q, boost::atomic* sum) const int val = q->pull(); sum->fetch_add(val); } - catch(std::exception& e ){ + catch(std::exception& ){ break; } } @@ -147,7 +147,7 @@ void move_between_queues(sync_pq* q1, sync_pq* q2) const int val = q1->pull(); q2->push(val); } - catch(std::exception& e){ + catch(std::exception& ){ break; } } diff --git a/test/test_10964.cpp b/test/test_10964.cpp index 9f6f6365..29dc0987 100644 --- a/test/test_10964.cpp +++ b/test/test_10964.cpp @@ -49,6 +49,7 @@ void p1() int main() { const int number_of_tests = 2; + (void)(number_of_tests); #if ! defined BOOST_NO_CXX11_DECLTYPE && ! defined BOOST_NO_CXX11_AUTO_DECLARATIONS std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl; diff --git a/test/test_11499.cpp b/test/test_11499.cpp new file mode 100644 index 00000000..2fe07ae8 --- /dev/null +++ b/test/test_11499.cpp @@ -0,0 +1,56 @@ +// Copyright (C) 2014 Vicente Botet +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#define BOOST_THREAD_VERSION 4 + +#include +#include +#include +#include +#include +#include + +using MutexT = boost::shared_mutex; +using ReaderLockT = std::lock_guard; +using WriterLockT = std::shared_lock; + +MutexT gMutex; +std::atomic running(true); + + +void myread() +{ + long reads = 0; + while (running && reads < 100000) + { + ReaderLockT lock(gMutex); + std::this_thread::yield(); + ++reads; + } +} + +int main() +{ + using namespace std; + + vector threads; + for (int i = 0; i < 256; ++i) + { + threads.emplace_back(thread(myread)); + } + +// string str; +// +// getline(std::cin, str); + running = false; + + for (auto& thread : threads) + { + thread.join(); + } + + return 0; +} + diff --git a/test/test_11611.cpp b/test/test_11611.cpp new file mode 100644 index 00000000..c0f044e7 --- /dev/null +++ b/test/test_11611.cpp @@ -0,0 +1,48 @@ +// Copyright (C) 2014 Vicente Botet +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +//#define BOOST_THREAD_VERSION 4 + +#include +//#include + +#define BOOST_THREAD_PROVIDES_FUTURE +#define BOOST_THREAD_PROVIDES_EXECUTORS +#define BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION +#include +#include +#include +#include + +using namespace std; + +int main() +{ + boost::loop_executor ex; + + //thread t([&ex]() + boost::thread t([&ex]() + { + ex.loop(); + }); + + { + //boost::serial_executor_cont serial(ex); + boost::serial_executor serial(ex); + + for (size_t i = 0; i < 1000000; i++) + serial.submit([i] { + //std::cout << i << "."; + }); + + serial.close(); + } + + ex.close(); + + t.join(); + std::cout << "end" << std::endl; + return 0; +} diff --git a/test/test_2741.cpp b/test/test_2741.cpp index 793e68cd..15826220 100644 --- a/test/test_2741.cpp +++ b/test/test_2741.cpp @@ -35,6 +35,7 @@ BOOST_AUTO_TEST_CASE(test_native_handle) boost::thread_attributes attrs; boost::thread_attributes::native_handle_type* h = attrs.native_handle(); + (void)(h); // unused #if defined(BOOST_THREAD_PLATFORM_WIN32) // ... window version #elif defined(BOOST_THREAD_PLATFORM_PTHREAD) @@ -75,3 +76,4 @@ BOOST_AUTO_TEST_CASE(test_creation_with_attrs) timed_test(&do_test_creation_with_attrs, 1); } + diff --git a/test/test_4648.cpp b/test/test_4648.cpp index 6a929b5f..34fb131a 100644 --- a/test/test_4648.cpp +++ b/test/test_4648.cpp @@ -30,7 +30,7 @@ int boostThreadLocksTest::firstFunction(boostThreadLocksTest *pBoostThreadLocksT std::cout<<"Returning from "<& upgr) { +int boostThreadLocksTest::secondFunction(boostThreadLocksTest *, boost::upgrade_lock& upgr) { std::cout<<"Before Exclusive Locking "< localUniqueLock(upgr); std::cout<<"After Exclusive Locking "<" << BOOST_THREAD_END_LOG; } 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 8f003d84..232712ee 100644 --- a/test/threads/this_thread/sleep_until/sleep_until_pass.cpp +++ b/test/threads/this_thread/sleep_until/sleep_until_pass.cpp @@ -28,7 +28,7 @@ int main() { typedef boost::chrono::steady_clock Clock; typedef Clock::time_point time_point; - typedef Clock::duration duration; + //typedef Clock::duration duration; boost::chrono::milliseconds ms(500); time_point t0 = Clock::now(); boost::this_thread::sleep_until(t0 + ms); @@ -43,7 +43,7 @@ int main() { typedef boost::chrono::system_clock Clock; typedef Clock::time_point time_point; - typedef Clock::duration duration; + //typedef Clock::duration duration; boost::chrono::milliseconds ms(500); time_point t0 = Clock::now(); boost::this_thread::sleep_until(t0 + ms); @@ -58,7 +58,7 @@ int main() { typedef boost::chrono::steady_clock Clock; typedef Clock::time_point time_point; - typedef Clock::duration duration; + //typedef Clock::duration duration; boost::chrono::milliseconds ms(500); time_point t0 = Clock::now(); boost::this_thread::no_interruption_point::sleep_until(t0 + ms); @@ -73,7 +73,7 @@ int main() { typedef boost::chrono::system_clock Clock; typedef Clock::time_point time_point; - typedef Clock::duration duration; + //typedef Clock::duration duration; boost::chrono::milliseconds ms(500); time_point t0 = Clock::now(); boost::this_thread::no_interruption_point::sleep_until(t0 + ms);