Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76277 - in trunk: boost/thread boost/thread/detail libs/thread/test
From: vicente.botet_at_[hidden]
Date: 2012-01-02 12:12:03


Author: viboes
Date: 2012-01-02 12:12:01 EST (Mon, 02 Jan 2012)
New Revision: 76277
URL: http://svn.boost.org/trac/boost/changeset/76277

Log:
Thread: #6141 - Compilation error when boost.thread and boost.move are used together
Added:
   trunk/libs/thread/test/test_6170.cpp (contents, props changed)
Text files modified:
   trunk/boost/thread/detail/move.hpp | 11 +----------
   trunk/boost/thread/detail/thread.hpp | 7 +++++++
   trunk/boost/thread/future.hpp | 28 ++++++++++++++++++++++++++++
   trunk/boost/thread/locks.hpp | 28 ++++++++++++++++++++++++++++
   trunk/libs/thread/test/Jamfile.v2 | 8 ++++++++
   5 files changed, 72 insertions(+), 10 deletions(-)

Modified: trunk/boost/thread/detail/move.hpp
==============================================================================
--- trunk/boost/thread/detail/move.hpp (original)
+++ trunk/boost/thread/detail/move.hpp 2012-01-02 12:12:01 EST (Mon, 02 Jan 2012)
@@ -6,15 +6,14 @@
 #ifndef BOOST_THREAD_MOVE_HPP
 #define BOOST_THREAD_MOVE_HPP
 
+#include <boost/thread/detail/config.hpp>
 #ifndef BOOST_NO_SFINAE
 #include <boost/utility/enable_if.hpp>
 #include <boost/type_traits/is_convertible.hpp>
 #include <boost/type_traits/remove_reference.hpp>
 #endif
 
-#ifndef BOOST_NO_RVALUE_REFERENCES
 #include <boost/move/move.hpp>
-#endif
 
 #include <boost/config/abi_prefix.hpp>
 
@@ -45,11 +44,6 @@
         };
     }
 
-#ifdef BOOST_THREAD_USES_SPECIFIC_MOVE_NS
-namespace threads {
-#endif
-
-
 #ifndef BOOST_NO_SFINAE
     template<typename T>
     typename enable_if<boost::is_convertible<T&,boost::detail::thread_move_t<T> >, boost::detail::thread_move_t<T> >::type move(T& t)
@@ -64,9 +58,6 @@
         return t;
     }
 
-#ifdef BOOST_THREAD_USES_SPECIFIC_MOVE_NS
-}
-#endif
 
 }
 

Modified: trunk/boost/thread/detail/thread.hpp
==============================================================================
--- trunk/boost/thread/detail/thread.hpp (original)
+++ trunk/boost/thread/detail/thread.hpp 2012-01-02 12:12:01 EST (Mon, 02 Jan 2012)
@@ -521,6 +521,13 @@
         void BOOST_THREAD_DECL add_thread_exit_function(thread_exit_function_base*);
     }
 
+#ifdef BOOST_NO_RVALUE_REFERENCES
+ template <>
+ struct has_move_emulation_enabled_aux<thread>
+ : BOOST_MOVE_BOOST_NS::integral_constant<bool, true>
+ {};
+#endif
+
     namespace this_thread
     {
         template<typename F>

Modified: trunk/boost/thread/future.hpp
==============================================================================
--- trunk/boost/thread/future.hpp (original)
+++ trunk/boost/thread/future.hpp 2012-01-02 12:12:01 EST (Mon, 02 Jan 2012)
@@ -754,6 +754,13 @@
 
     };
 
+#ifdef BOOST_NO_RVALUE_REFERENCES
+ template <typename T>
+ struct has_move_emulation_enabled_aux<unique_future<T> >
+ : BOOST_MOVE_BOOST_NS::integral_constant<bool, true>
+ {};
+#endif
+
     template <typename R>
     class shared_future
     {
@@ -912,6 +919,13 @@
 
     };
 
+#ifdef BOOST_NO_RVALUE_REFERENCES
+ template <typename T>
+ struct has_move_emulation_enabled_aux<shared_future<T> >
+ : BOOST_MOVE_BOOST_NS::integral_constant<bool, true>
+ {};
+#endif
+
     template <typename R>
     class promise
     {
@@ -1178,6 +1192,13 @@
 
     };
 
+#ifdef BOOST_NO_RVALUE_REFERENCES
+ template <typename T>
+ struct has_move_emulation_enabled_aux<promise<T> >
+ : BOOST_MOVE_BOOST_NS::integral_constant<bool, true>
+ {};
+#endif
+
     namespace detail
     {
         template<typename R>
@@ -1409,6 +1430,13 @@
 
     };
 
+#ifdef BOOST_NO_RVALUE_REFERENCES
+ template <typename T>
+ struct has_move_emulation_enabled_aux<packaged_task<T> >
+ : BOOST_MOVE_BOOST_NS::integral_constant<bool, true>
+ {};
+#endif
+
 }
 
 

Modified: trunk/boost/thread/locks.hpp
==============================================================================
--- trunk/boost/thread/locks.hpp (original)
+++ trunk/boost/thread/locks.hpp 2012-01-02 12:12:01 EST (Mon, 02 Jan 2012)
@@ -518,6 +518,13 @@
     }
 #endif
 
+#ifdef BOOST_NO_RVALUE_REFERENCES
+ template <typename Mutex>
+ struct has_move_emulation_enabled_aux<unique_lock<Mutex> >
+ : BOOST_MOVE_BOOST_NS::integral_constant<bool, true>
+ {};
+#endif
+
     template<typename Mutex>
     class shared_lock
     {
@@ -712,6 +719,14 @@
 
     };
 
+#ifdef BOOST_NO_RVALUE_REFERENCES
+ template <typename Mutex>
+ struct has_move_emulation_enabled_aux<shared_lock<Mutex> >
+ : BOOST_MOVE_BOOST_NS::integral_constant<bool, true>
+ {};
+#endif
+
+
 #ifndef BOOST_NO_RVALUE_REFERENCES
     template<typename Mutex>
     void swap(shared_lock<Mutex>&& lhs,shared_lock<Mutex>&& rhs)
@@ -896,6 +911,12 @@
         friend class unique_lock<Mutex>;
     };
 
+#ifdef BOOST_NO_RVALUE_REFERENCES
+ template <typename Mutex>
+ struct has_move_emulation_enabled_aux<upgrade_lock<Mutex> >
+ : BOOST_MOVE_BOOST_NS::integral_constant<bool, true>
+ {};
+#endif
 
 #ifndef BOOST_NO_RVALUE_REFERENCES
     template<typename Mutex>
@@ -988,6 +1009,13 @@
         }
     };
 
+#ifdef BOOST_NO_RVALUE_REFERENCES
+ template <typename Mutex>
+ struct has_move_emulation_enabled_aux<upgrade_to_unique_lock<Mutex> >
+ : BOOST_MOVE_BOOST_NS::integral_constant<bool, true>
+ {};
+#endif
+
     namespace detail
     {
         template<typename Mutex>

Modified: trunk/libs/thread/test/Jamfile.v2
==============================================================================
--- trunk/libs/thread/test/Jamfile.v2 (original)
+++ trunk/libs/thread/test/Jamfile.v2 2012-01-02 12:12:01 EST (Mon, 02 Jan 2012)
@@ -62,4 +62,12 @@
           [ compile-fail no_implicit_move_from_lvalue_thread.cpp ]
           [ compile-fail no_implicit_assign_from_lvalue_thread.cpp ]
     ;
+
+
+ #explicit tickets ;
+ test-suite tickets
+ :
+ [ compile test_6170.cpp ]
+ ;
+
 }

Added: trunk/libs/thread/test/test_6170.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/thread/test/test_6170.cpp 2012-01-02 12:12:01 EST (Mon, 02 Jan 2012)
@@ -0,0 +1,22 @@
+#include <boost/thread/shared_mutex.hpp>
+#include <boost/thread/locks.hpp>
+
+// Including this will cause ambiguous errors in boost::move
+#include <boost/unordered_map.hpp>
+
+using namespace boost;
+
+typedef upgrade_lock<shared_mutex> auto_upgrade_lock;
+typedef upgrade_to_unique_lock<shared_mutex> auto_upgrade_unique_lock;
+
+void testUpgrade(void);
+
+void testUpgrade(void)
+{
+ 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
+}


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk