diff --git a/include/boost/thread/detail/move.hpp b/include/boost/thread/detail/move.hpp index 011ae4ea..99beb5bb 100644 --- a/include/boost/thread/detail/move.hpp +++ b/include/boost/thread/detail/move.hpp @@ -22,6 +22,8 @@ namespace boost { return &t; } + private: + void operator=(thread_move_t&); }; } diff --git a/include/boost/thread/pthread/shared_mutex.hpp b/include/boost/thread/pthread/shared_mutex.hpp index 4cc095a2..4465f559 100644 --- a/include/boost/thread/pthread/shared_mutex.hpp +++ b/include/boost/thread/pthread/shared_mutex.hpp @@ -57,7 +57,14 @@ namespace boost boost::this_thread::disable_interruption do_not_disturb; boost::mutex::scoped_lock lock(state_change); +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4127) +#endif while(true) +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif { if(!state.exclusive && !state.exclusive_waiting_blocked) { @@ -89,7 +96,14 @@ namespace boost boost::this_thread::disable_interruption do_not_disturb; boost::mutex::scoped_lock lock(state_change); +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4127) +#endif while(true) +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif { if(!state.exclusive && !state.exclusive_waiting_blocked) { @@ -130,7 +144,14 @@ namespace boost boost::this_thread::disable_interruption do_not_disturb; boost::mutex::scoped_lock lock(state_change); +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4127) +#endif while(true) +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif { if(state.shared_count || state.exclusive) { @@ -150,7 +171,14 @@ namespace boost boost::this_thread::disable_interruption do_not_disturb; boost::mutex::scoped_lock lock(state_change); +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4127) +#endif while(true) +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif { if(state.shared_count || state.exclusive) { @@ -196,7 +224,14 @@ namespace boost { boost::this_thread::disable_interruption do_not_disturb; boost::mutex::scoped_lock lock(state_change); +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4127) +#endif while(true) +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif { if(!state.exclusive && !state.exclusive_waiting_blocked && !state.upgrade) { @@ -213,7 +248,14 @@ namespace boost { boost::this_thread::disable_interruption do_not_disturb; boost::mutex::scoped_lock lock(state_change); +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4127) +#endif while(true) +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif { if(!state.exclusive && !state.exclusive_waiting_blocked && !state.upgrade) { @@ -262,7 +304,14 @@ namespace boost boost::this_thread::disable_interruption do_not_disturb; boost::mutex::scoped_lock lock(state_change); --state.shared_count; +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4127) +#endif while(true) +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif { if(!state.shared_count) { diff --git a/include/boost/thread/pthread/thread.hpp b/include/boost/thread/pthread/thread.hpp index f539d568..6a2ac3d9 100644 --- a/include/boost/thread/pthread/thread.hpp +++ b/include/boost/thread/pthread/thread.hpp @@ -22,6 +22,12 @@ #include #include "thread_data.hpp" #include +#include + +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4251) +#endif namespace boost { @@ -319,7 +325,7 @@ namespace boost } } - class BOOST_THREAD_DECL thread_group : private noncopyable + class BOOST_THREAD_DECL thread_group { public: thread_group(); @@ -330,13 +336,20 @@ namespace boost void remove_thread(thread* thrd); void join_all(); void interrupt_all(); - int size() const; + size_t size() const; private: + thread_group(thread_group&); + void operator=(thread_group&); + std::list m_threads; mutex m_mutex; }; } // namespace boost +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + #endif diff --git a/include/boost/thread/pthread/thread_data.hpp b/include/boost/thread/pthread/thread_data.hpp index 234ba882..52ca40e5 100644 --- a/include/boost/thread/pthread/thread_data.hpp +++ b/include/boost/thread/pthread/thread_data.hpp @@ -72,6 +72,7 @@ namespace boost } } + void operator=(interruption_checker&); public: explicit interruption_checker(pthread_cond_t* cond): thread_info(detail::get_current_thread_data()) diff --git a/include/boost/thread/win32/basic_timed_mutex.hpp b/include/boost/thread/win32/basic_timed_mutex.hpp index 8ee199df..207c0920 100644 --- a/include/boost/thread/win32/basic_timed_mutex.hpp +++ b/include/boost/thread/win32/basic_timed_mutex.hpp @@ -33,7 +33,14 @@ namespace boost void destroy() { +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4312) +#endif void* const old_event=BOOST_INTERLOCKED_EXCHANGE_POINTER(&event,0); +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif if(old_event) { win32::CloseHandle(old_event); @@ -64,7 +71,14 @@ namespace boost bool timed_lock(::boost::system_time const& wait_until) { long old_count=active_count; +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4127) +#endif while(true) +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif { long const current_count=BOOST_INTERLOCKED_COMPARE_EXCHANGE(&active_count,(old_count+1)|lock_flag_value,old_count); if(current_count==old_count) @@ -139,7 +153,15 @@ namespace boost if(!current_event) { void* const new_event=win32::create_anonymous_event(win32::auto_reset_event,win32::event_initially_reset); +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4311) +#pragma warning(disable:4312) +#endif void* const old_event=BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(&event,new_event,0); +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif if(old_event!=0) { win32::CloseHandle(new_event); diff --git a/include/boost/thread/win32/condition_variable.hpp b/include/boost/thread/win32/condition_variable.hpp index bfd1f1ff..6bd4efd6 100644 --- a/include/boost/thread/win32/condition_variable.hpp +++ b/include/boost/thread/win32/condition_variable.hpp @@ -55,10 +55,17 @@ namespace boost } else { - active_generation_count=(last_active_entry-generations)+1; + active_generation_count=unsigned(last_active_entry-generations)+1; } - + +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4996) +#endif std::copy_backward(generations,generations+active_generation_count-1,generations+active_generation_count); +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif generations[0]=list_entry(); } @@ -108,6 +115,8 @@ namespace boost } } + private: + void operator=(relocker&); }; diff --git a/include/boost/thread/win32/once.hpp b/include/boost/thread/win32/once.hpp index b11be97a..719eaea5 100644 --- a/include/boost/thread/win32/once.hpp +++ b/include/boost/thread/win32/once.hpp @@ -46,6 +46,8 @@ namespace boost { BOOST_VERIFY(win32::ReleaseMutex(mutex_handle)!=0); } + private: + void operator=(win32_mutex_scoped_lock&); }; #ifdef BOOST_NO_ANSI_APIS diff --git a/include/boost/thread/win32/shared_mutex.hpp b/include/boost/thread/win32/shared_mutex.hpp index 3b322b1f..1c9fd1be 100644 --- a/include/boost/thread/win32/shared_mutex.hpp +++ b/include/boost/thread/win32/shared_mutex.hpp @@ -1,7 +1,7 @@ #ifndef BOOST_THREAD_WIN32_SHARED_MUTEX_HPP #define BOOST_THREAD_WIN32_SHARED_MUTEX_HPP -// (C) Copyright 2006-7 Anthony Williams +// (C) Copyright 2006-8 Anthony Williams // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -104,7 +104,14 @@ namespace boost } old_state=current_state; } +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4127) +#endif while(true); +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif return !(old_state.exclusive| old_state.exclusive_waiting_blocked); } @@ -115,7 +122,14 @@ namespace boost bool timed_lock_shared(boost::system_time const& wait_until) { +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4127) +#endif while(true) +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif { state_data old_state=state; do @@ -137,7 +151,14 @@ namespace boost } old_state=current_state; } +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4127) +#endif while(true); +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif if(!(old_state.exclusive| old_state.exclusive_waiting_blocked)) { @@ -169,7 +190,14 @@ namespace boost } old_state=current_state; } +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4127) +#endif while(true); +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif if(!(old_state.exclusive| old_state.exclusive_waiting_blocked)) { @@ -226,7 +254,14 @@ namespace boost } old_state=current_state; } +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4127) +#endif while(true); +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif } void lock() @@ -236,7 +271,14 @@ namespace boost bool timed_lock(boost::system_time const& wait_until) { +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4127) +#endif while(true) +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif { state_data old_state=state; @@ -260,7 +302,14 @@ namespace boost } old_state=current_state; } +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4127) +#endif while(true); +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif if(!old_state.shared_count && !old_state.exclusive) { @@ -291,7 +340,14 @@ namespace boost } old_state=current_state; } +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4127) +#endif while(true); +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif if(!old_state.shared_count && !old_state.exclusive) { return true; @@ -323,13 +379,27 @@ namespace boost } old_state=current_state; } +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4127) +#endif while(true); +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif release_waiters(old_state); } void lock_upgrade() { +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4127) +#endif while(true) +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif { state_data old_state=state; do @@ -352,7 +422,14 @@ namespace boost } old_state=current_state; } +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4127) +#endif while(true); +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif if(!(old_state.exclusive|| old_state.exclusive_waiting_blocked|| old_state.upgrade)) { @@ -393,7 +470,14 @@ namespace boost } old_state=current_state; } +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4127) +#endif while(true); +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif } void unlock_upgrade_and_lock() @@ -421,7 +505,14 @@ namespace boost } old_state=current_state; } +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4127) +#endif while(true); +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif } void unlock_and_lock_upgrade() @@ -447,7 +538,14 @@ namespace boost } old_state=current_state; } +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4127) +#endif while(true); +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif release_waiters(old_state); } @@ -473,7 +571,14 @@ namespace boost } old_state=current_state; } +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4127) +#endif while(true); +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif release_waiters(old_state); } @@ -498,7 +603,14 @@ namespace boost } old_state=current_state; } +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4127) +#endif while(true); +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif release_waiters(old_state); } diff --git a/include/boost/thread/win32/thread.hpp b/include/boost/thread/win32/thread.hpp index 61c2908a..90c73224 100644 --- a/include/boost/thread/win32/thread.hpp +++ b/include/boost/thread/win32/thread.hpp @@ -21,6 +21,13 @@ #include #include #include +#include +#include + +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4251) +#endif namespace boost { @@ -476,9 +483,9 @@ namespace boost thread* create_thread(F threadfunc) { boost::lock_guard guard(m); - thread* const new_thread=new thread(threadfunc); - threads.push_back(new_thread); - return new_thread; + std::auto_ptr new_thread(new thread(threadfunc)); + threads.push_back(new_thread.get()); + return new_thread.release(); } void add_thread(thread* thrd) @@ -524,7 +531,7 @@ namespace boost } } - int size() const + size_t size() const { boost::lock_guard guard(m); return threads.size(); @@ -536,4 +543,8 @@ namespace boost }; } +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + #endif diff --git a/src/pthread/thread.cpp b/src/pthread/thread.cpp index 0add81c6..754e0af5 100644 --- a/src/pthread/thread.cpp +++ b/src/pthread/thread.cpp @@ -683,7 +683,7 @@ namespace boost } - int thread_group::size() const + size_t thread_group::size() const { return m_threads.size(); } diff --git a/src/win32/tss_pe.cpp b/src/win32/tss_pe.cpp index dec71c3b..bd2e61d8 100644 --- a/src/win32/tss_pe.cpp +++ b/src/win32/tss_pe.cpp @@ -164,6 +164,10 @@ extern "C" const IMAGE_TLS_DIRECTORY32 _tls_used __attribute__ ((section(".rdata #endif #endif +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4189) +#endif PVAPI on_tls_prepare(void) { //The following line has an important side effect: @@ -201,6 +205,9 @@ extern "C" const IMAGE_TLS_DIRECTORY32 _tls_used __attribute__ ((section(".rdata return INIRETSUCCESS; } +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif PVAPI on_process_init(void) { @@ -228,7 +235,7 @@ extern "C" const IMAGE_TLS_DIRECTORY32 _tls_used __attribute__ ((section(".rdata return INIRETSUCCESS; } - void NTAPI on_tls_callback(HINSTANCE h, DWORD dwReason, PVOID pv) + void NTAPI on_tls_callback(HINSTANCE /*h*/, DWORD dwReason, PVOID /*pv*/) { switch (dwReason) { diff --git a/test/condition_test_common.hpp b/test/condition_test_common.hpp index df7d5edc..38f77909 100644 --- a/test/condition_test_common.hpp +++ b/test/condition_test_common.hpp @@ -34,6 +34,8 @@ struct wait_for_flag { return flag; } + private: + void operator=(check_flag&); }; diff --git a/test/shared_mutex_locking_thread.hpp b/test/shared_mutex_locking_thread.hpp index 1fccbddf..0d071bd8 100644 --- a/test/shared_mutex_locking_thread.hpp +++ b/test/shared_mutex_locking_thread.hpp @@ -1,6 +1,12 @@ #ifndef SHARED_MUTEX_LOCKING_THREAD_HPP #define SHARED_MUTEX_LOCKING_THREAD_HPP +// (C) Copyright 2008 Anthony Williams +// +// 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) + #include #include #include @@ -56,6 +62,8 @@ public: --simultaneous_running_count; } } +private: + void operator=(locking_thread&); }; diff --git a/test/test_condition.cpp b/test/test_condition.cpp index 96b1e86e..ea008bfe 100644 --- a/test/test_condition.cpp +++ b/test/test_condition.cpp @@ -43,6 +43,9 @@ struct cond_predicate int& _var; int _val; +private: + void operator=(cond_predicate&); + }; void condition_test_waits(condition_test_data* data) diff --git a/test/test_shared_mutex_part_2.cpp b/test/test_shared_mutex_part_2.cpp index 5666a956..ae7348df 100644 --- a/test/test_shared_mutex_part_2.cpp +++ b/test/test_shared_mutex_part_2.cpp @@ -116,6 +116,8 @@ namespace boost::mutex& unblocked_mutex; unsigned& unblocked_count; + void operator=(simple_writing_thread&); + public: simple_writing_thread(boost::shared_mutex& rwm_, boost::mutex& finish_mutex_, @@ -182,6 +184,8 @@ namespace boost::mutex& unblocked_mutex; unsigned& unblocked_count; + void operator=(simple_reading_thread&); + public: simple_reading_thread(boost::shared_mutex& rwm_, boost::mutex& finish_mutex_, diff --git a/test/test_tss.cpp b/test/test_tss.cpp index 51dcb7ff..bbd78d42 100644 --- a/test/test_tss.cpp +++ b/test/test_tss.cpp @@ -66,7 +66,7 @@ void test_tss_thread() #if defined(BOOST_THREAD_PLATFORM_WIN32) typedef HANDLE native_thread_t; - DWORD WINAPI test_tss_thread_native(LPVOID lpParameter) + DWORD WINAPI test_tss_thread_native(LPVOID /*lpParameter*/) { test_tss_thread(); return 0; diff --git a/test/util.inl b/test/util.inl index 417b255d..5c761d50 100644 --- a/test/util.inl +++ b/test/util.inl @@ -1,6 +1,6 @@ // Copyright (C) 2001-2003 // William E. Kempf -// Copyright (C) 2007 Anthony Williams +// Copyright (C) 2007-8 Anthony Williams // // 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) @@ -123,6 +123,7 @@ public: private: F func; execution_monitor& monitor; + void operator=(indirect_adapter&); }; template @@ -165,6 +166,8 @@ public: void operator()() const { (param.*func)(); } private: + void operator=(thread_member_binder&); + R (T::*func)(); T& param; };