Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r82437 - in branches/release: boost/thread boost/thread/detail libs/thread libs/thread/build libs/thread/example libs/thread/test libs/thread/test/sync/mutual_exclusion/locks/unique_lock/cons
From: vicente.botet_at_[hidden]
Date: 2013-01-10 16:38:44


Author: viboes
Date: 2013-01-10 16:38:43 EST (Thu, 10 Jan 2013)
New Revision: 82437
URL: http://svn.boost.org/trac/boost/changeset/82437

Log:
Thread: merge from trun 1.53: some minor fixes on the regression tests.
Properties modified:
   branches/release/boost/thread/ (props changed)
   branches/release/libs/thread/ (props changed)
Text files modified:
   branches/release/boost/thread/detail/config.hpp | 9 +++-
   branches/release/boost/thread/detail/thread.hpp | 2
   branches/release/boost/thread/externally_locked_stream.hpp | 77 +++++++++++++++++++++------------------
   branches/release/boost/thread/lock_factories.hpp | 4 +-
   branches/release/libs/thread/build/Jamfile.v2 | 2
   branches/release/libs/thread/example/not_interleaved.cpp | 10 ++++-
   branches/release/libs/thread/test/Jamfile.v2 | 25 ++++++++++--
   branches/release/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/cons/make_unique_locks_mutex_pass.cpp | 2
   8 files changed, 82 insertions(+), 49 deletions(-)

Modified: branches/release/boost/thread/detail/config.hpp
==============================================================================
--- branches/release/boost/thread/detail/config.hpp (original)
+++ branches/release/boost/thread/detail/config.hpp 2013-01-10 16:38:43 EST (Thu, 10 Jan 2013)
@@ -69,8 +69,13 @@
 
 #if defined BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX || defined BOOST_NO_CXX11_HDR_INITIALIZER_LIST
 #define BOOST_THREAD_NO_CXX11_HDR_INITIALIZER_LIST
-//#elif defined __GNUC__ && (__GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ <= 6 ))
-//#define BOOST_THREAD_NO_CXX11_HDR_INITIALIZER_LIST
+#endif
+
+#if defined(BOOST_NO_CXX11_HDR_TUPLE) || defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
+#define BOOST_THREAD_NO_CXX11_HDR_TUPLE
+#elif defined _MSC_VER && _MSC_VER <= 1600
+// C++ features supported by VC++ 10 (aka 2010)
+#define BOOST_THREAD_NO_CXX11_HDR_TUPLE
 #endif
 
 /// BASIC_THREAD_ID

Modified: branches/release/boost/thread/detail/thread.hpp
==============================================================================
--- branches/release/boost/thread/detail/thread.hpp (original)
+++ branches/release/boost/thread/detail/thread.hpp 2013-01-10 16:38:43 EST (Thu, 10 Jan 2013)
@@ -767,7 +767,7 @@
         else
         {
           BOOST_THREAD_THROW_ELSE_RETURN(
- thread_resource_error(system::errc::invalid_argument, "boost thread: thread not joinable"),
+ (thread_resource_error(system::errc::invalid_argument, "boost thread: thread not joinable")),
             false
           );
         }

Modified: branches/release/boost/thread/externally_locked_stream.hpp
==============================================================================
--- branches/release/boost/thread/externally_locked_stream.hpp (original)
+++ branches/release/boost/thread/externally_locked_stream.hpp 2013-01-10 16:38:43 EST (Thu, 10 Jan 2013)
@@ -14,6 +14,7 @@
 #include <boost/thread/externally_locked.hpp>
 #include <boost/thread/lock_traits.hpp>
 #include <boost/thread/recursive_mutex.hpp>
+#include <boost/thread/strict_lock.hpp>
 
 #include <boost/config/abi_prefix.hpp>
 
@@ -26,30 +27,30 @@
   // return mtx;
   // }
 
- template <typename Stream>
+ template <typename Stream, typename RecursiveMutex=recursive_mutex>
   class externally_locked_stream;
 
- template <class Stream>
+ template <class Stream, typename RecursiveMutex=recursive_mutex>
   class stream_guard
   {
- stream_guard(externally_locked_stream<Stream>& mtx, adopt_lock_t) :
- mtx_(mtx)
- {
- }
-
 
- friend class externally_locked_stream<Stream> ;
+ friend class externally_locked_stream<Stream, RecursiveMutex> ;
   public:
- typedef typename externally_locked_stream<Stream>::mutex_type mutex_type;
+ typedef typename externally_locked_stream<Stream, RecursiveMutex>::mutex_type mutex_type;
 
     BOOST_THREAD_MOVABLE_ONLY( stream_guard)
 
- stream_guard(externally_locked_stream<Stream>& mtx) :
+ stream_guard(externally_locked_stream<Stream, RecursiveMutex>& mtx) :
       mtx_(&mtx)
     {
       mtx.lock();
     }
 
+ stream_guard(externally_locked_stream<Stream, RecursiveMutex>& mtx, adopt_lock_t) :
+ mtx_(&mtx)
+ {
+ }
+
     stream_guard(BOOST_THREAD_RV_REF(stream_guard) rhs)
     : mtx_(rhs.mtx_)
     {
@@ -72,85 +73,91 @@
     }
 
   private:
- externally_locked_stream<Stream>* mtx_;
+ externally_locked_stream<Stream, RecursiveMutex>* mtx_;
   };
 
- template <typename Stream>
- struct is_strict_lock_sur_parolle<stream_guard<Stream> > : true_type
+ template <typename Stream, typename RecursiveMutex>
+ struct is_strict_lock_sur_parolle<stream_guard<Stream, RecursiveMutex> > : true_type
   {
   };
 
   /**
- * externally_locked_stream_stream cloaks a reference to an stream of type Stream, and actually
+ * externally_locked_stream cloaks a reference to an stream of type Stream, and actually
    * provides full access to that object through the get and set member functions, provided you
    * pass a reference to a strict lock object.
    */
 
   //[externally_locked_stream
- template <typename Stream>
- class externally_locked_stream: public externally_locked<Stream&, recursive_mutex>
+ template <typename Stream, typename RecursiveMutex>
+ class externally_locked_stream: public externally_locked<Stream&, RecursiveMutex>
   {
- typedef externally_locked<Stream&, recursive_mutex> base_type;
+ typedef externally_locked<Stream&, RecursiveMutex> base_type;
   public:
     BOOST_THREAD_NO_COPYABLE( externally_locked_stream)
 
     /**
      * Effects: Constructs an externally locked object storing the cloaked reference object.
      */
- externally_locked_stream(Stream& stream, recursive_mutex& mtx) :
+ externally_locked_stream(Stream& stream, RecursiveMutex& mtx) :
       base_type(stream, mtx)
     {
     }
 
- stream_guard<Stream> hold()
+ stream_guard<Stream, RecursiveMutex> hold()
     {
- return stream_guard<Stream> (*this);
+ return stream_guard<Stream, RecursiveMutex> (*this);
     }
 
+ Stream& hold(strict_lock<RecursiveMutex>& lk)
+ {
+ return this->get(lk);
+ }
+
+
   };
   //]
 
- template <typename Stream, typename T>
- inline const stream_guard<Stream>& operator<<(const stream_guard<Stream>& lck, T arg)
+ template <typename Stream, typename RecursiveMutex, typename T>
+ inline const stream_guard<Stream, RecursiveMutex>& operator<<(const stream_guard<Stream, RecursiveMutex>& lck, T arg)
   {
     lck.get() << arg;
     return lck;
   }
 
- template <typename Stream>
- inline const stream_guard<Stream>& operator<<(const stream_guard<Stream>& lck, Stream& (*arg)(Stream&))
+ template <typename Stream, typename RecursiveMutex>
+ inline const stream_guard<Stream, RecursiveMutex>& operator<<(const stream_guard<Stream, RecursiveMutex>& lck, Stream& (*arg)(Stream&))
   {
     lck.get() << arg;
     return lck;
   }
 
- template <typename Stream, typename T>
- inline const stream_guard<Stream>& operator>>(const stream_guard<Stream>& lck, T& arg)
+ template <typename Stream, typename RecursiveMutex, typename T>
+ inline const stream_guard<Stream, RecursiveMutex>& operator>>(const stream_guard<Stream, RecursiveMutex>& lck, T& arg)
   {
     lck.get() >> arg;
     return lck;
   }
 
- template <typename Stream, typename T>
- inline stream_guard<Stream> operator<<(externally_locked_stream<Stream>& mtx, T arg)
+ template <typename Stream, typename RecursiveMutex, typename T>
+ inline stream_guard<Stream, RecursiveMutex> operator<<(externally_locked_stream<Stream, RecursiveMutex>& mtx, T arg)
   {
- stream_guard<Stream> lk(mtx);
+ stream_guard<Stream, RecursiveMutex> lk(mtx);
     mtx.get(lk) << arg;
     return boost::move(lk);
   }
 
- template <typename Stream>
- inline stream_guard<Stream> operator<<(externally_locked_stream<Stream>& mtx, Stream& (*arg)(Stream&))
+ template <typename Stream, typename RecursiveMutex>
+ inline stream_guard<Stream, RecursiveMutex> operator<<(externally_locked_stream<Stream, RecursiveMutex>& mtx, Stream& (*arg)(Stream&))
   {
- stream_guard<Stream> lk(mtx);
+ stream_guard<Stream, RecursiveMutex> lk(mtx);
     mtx.get(lk) << arg;
     return boost::move(lk);
   }
 
- template <typename Stream, typename T>
- inline stream_guard<Stream> operator>>(externally_locked_stream<Stream>& mtx, T& arg)
+ template <typename Stream, typename RecursiveMutex, typename T>
+ inline stream_guard<Stream, RecursiveMutex> operator>>(externally_locked_stream<Stream, RecursiveMutex>& mtx, T& arg)
   {
- stream_guard<Stream> lk(mtx);
+ stream_guard<Stream, RecursiveMutex> lk(mtx);
     mtx.get(lk) >> arg;
     return boost::move(lk);
   }

Modified: branches/release/boost/thread/lock_factories.hpp
==============================================================================
--- branches/release/boost/thread/lock_factories.hpp (original)
+++ branches/release/boost/thread/lock_factories.hpp 2013-01-10 16:38:43 EST (Thu, 10 Jan 2013)
@@ -8,7 +8,7 @@
 
 #include <boost/thread/lock_types.hpp>
 #include <boost/thread/lock_algorithms.hpp>
-#if ! defined(BOOST_NO_CXX11_HDR_TUPLE)
+#if ! defined(BOOST_THREAD_NO_CXX11_HDR_TUPLE)
 #include <tuple> // todo change to <boost/tuple.hpp> once Boost.Tuple or Boost.Fusion provides Move semantics.
 #endif
 #include <boost/config/abi_prefix.hpp>
@@ -39,7 +39,7 @@
   {
     return unique_lock<Lockable> (mtx, try_to_lock);
   }
-#if ! defined(BOOST_NO_CXX11_HDR_TUPLE)
+#if ! defined(BOOST_THREAD_NO_CXX11_HDR_TUPLE)
 
 #if ! defined BOOST_NO_CXX11_VARIADIC_TEMPLATES
   template <typename ...Lockable>

Modified: branches/release/libs/thread/build/Jamfile.v2
==============================================================================
--- branches/release/libs/thread/build/Jamfile.v2 (original)
+++ branches/release/libs/thread/build/Jamfile.v2 2013-01-10 16:38:43 EST (Thu, 10 Jan 2013)
@@ -225,7 +225,7 @@
         }
     }
 
- if ! <toolset>vacpp in $(properties) || <toolset-vacpp:version>11.1 in $(properties)
+ if ! <toolset>vacpp in $(properties) || <toolset-vacpp:version>11.1 in $(properties) || <toolset-vacpp:version>12.1.0.1 in $(properties)
     {
       result += <library>/boost/chrono//boost_chrono ;
     }

Modified: branches/release/libs/thread/example/not_interleaved.cpp
==============================================================================
--- branches/release/libs/thread/example/not_interleaved.cpp (original)
+++ branches/release/libs/thread/example/not_interleaved.cpp 2013-01-10 16:38:43 EST (Thu, 10 Jan 2013)
@@ -48,9 +48,15 @@
   scoped_thread<> t2(thread(use_cout, boost::ref(mcout)));
   this_thread::sleep_for(chrono::seconds(2));
   std::string nm;
- mcout << "Enter name: ";
- //mcin >> nm;
+ {
+ strict_lock<recursive_mutex> lk(terminal_mutex);
+ auto& gcout = mcout.hold(lk);
+ auto& gcin = mcin.hold(lk);
+ gcout << "Enter name: ";
+ //gcin >> nm;
+ }
   t1.join();
+ t2.join();
   mcout << nm << '\n';
   return 1;
 }

Modified: branches/release/libs/thread/test/Jamfile.v2
==============================================================================
--- branches/release/libs/thread/test/Jamfile.v2 (original)
+++ branches/release/libs/thread/test/Jamfile.v2 2013-01-10 16:38:43 EST (Thu, 10 Jan 2013)
@@ -132,6 +132,20 @@
     ;
 }
 
+rule thread-run2-noit-pthread ( sources : name )
+{
+ return
+ [ run $(sources) ../build//boost_thread : : : <threadapi>win32:<build>no
+ : $(name) ]
+ [ run $(sources) ../src/tss_null.cpp ../build//boost_thread/<link>static
+ : : : <threadapi>win32:<build>no
+ : $(name)_lib ]
+ #[ run $(sources) ../build//boost_thread : : :
+ # <define>BOOST_THREAD_DONT_PROVIDE_INTERRUPTIONS
+ # : $(name)_noit ]
+ ;
+}
+
 rule thread-run2-h ( sources : name )
 {
     return
@@ -253,7 +267,7 @@
           [ thread-compile-fail ./sync/conditions/condition_variable/copy_fail.cpp : : condition_variable__copy_f ]
           [ thread-run2-noit ./sync/conditions/condition_variable/default_pass.cpp : condition_variable__default_p ]
           [ thread-run2-noit ./sync/conditions/condition_variable/dtor_pass.cpp : condition_variable__dtor_p ]
- [ thread-run2-noit ./sync/conditions/condition_variable/native_handle_pass.cpp : condition_variable__native_handle_p ]
+ [ thread-run2-noit-pthread ./sync/conditions/condition_variable/native_handle_pass.cpp : condition_variable__native_handle_p ]
           [ thread-run2-noit ./sync/conditions/condition_variable/wait_pass.cpp : condition_variable__wait_p ]
           [ thread-run2-noit ./sync/conditions/condition_variable/wait_for_pass.cpp : condition_variable__wait_for_p ]
           [ thread-run2-noit ./sync/conditions/condition_variable/wait_for_pred_pass.cpp : condition_variable__wait_for_pred_p ]
@@ -502,7 +516,7 @@
           [ thread-compile-fail ./sync/mutual_exclusion/mutex/copy_fail.cpp : : mutex__copy_f ]
           [ thread-run2-noit ./sync/mutual_exclusion/mutex/default_pass.cpp : mutex__default_p ]
           [ thread-run2-noit ./sync/mutual_exclusion/mutex/lock_pass.cpp : mutex__lock_p ]
- [ thread-run2-noit ./sync/mutual_exclusion/mutex/native_handle_pass.cpp : mutex__native_handle_p ]
+ [ thread-run2-noit-pthread ./sync/mutual_exclusion/mutex/native_handle_pass.cpp : mutex__native_handle_p ]
           [ thread-run2-noit ./sync/mutual_exclusion/mutex/try_lock_pass.cpp : mutex__try_lock_p ]
     ;
 
@@ -513,7 +527,7 @@
           [ thread-compile-fail ./sync/mutual_exclusion/recursive_mutex/copy_fail.cpp : : recursive_mutex__copy_f ]
           [ thread-run2-noit ./sync/mutual_exclusion/recursive_mutex/default_pass.cpp : recursive_mutex__default_p ]
           [ thread-run2-noit ./sync/mutual_exclusion/recursive_mutex/lock_pass.cpp : recursive_mutex__lock_p ]
- [ thread-run2-noit ./sync/mutual_exclusion/recursive_mutex/native_handle_pass.cpp : recursive_mutex__native_handle_p ]
+ [ thread-run2-noit-pthread ./sync/mutual_exclusion/recursive_mutex/native_handle_pass.cpp : recursive_mutex__native_handle_p ]
           [ thread-run2-noit ./sync/mutual_exclusion/recursive_mutex/try_lock_pass.cpp : recursive_mutex__try_lock_p ]
     ;
 
@@ -524,7 +538,7 @@
           [ thread-compile-fail ./sync/mutual_exclusion/recursive_timed_mutex/copy_fail.cpp : : recursive_timed_mutex__copy_f ]
           [ thread-run2-noit ./sync/mutual_exclusion/recursive_timed_mutex/default_pass.cpp : recursive_timed_mutex__default_p ]
           [ thread-run2-noit ./sync/mutual_exclusion/recursive_timed_mutex/lock_pass.cpp : recursive_timed_mutex__lock_p ]
- [ thread-run2-noit ./sync/mutual_exclusion/recursive_timed_mutex/native_handle_pass.cpp : recursive_timed_mutex__native_handle_p ]
+ [ thread-run2-noit-pthread ./sync/mutual_exclusion/recursive_timed_mutex/native_handle_pass.cpp : recursive_timed_mutex__native_handle_p ]
           [ thread-run2-noit ./sync/mutual_exclusion/recursive_timed_mutex/try_lock_for_pass.cpp : recursive_timed_mutex__try_lock_for_p ]
           [ thread-run2-noit ./sync/mutual_exclusion/recursive_timed_mutex/try_lock_pass.cpp : recursive_timed_mutex__try_lock_p ]
           [ thread-run2-noit ./sync/mutual_exclusion/recursive_timed_mutex/try_lock_until_pass.cpp : recursive_timed_mutex__try_lock_until_p ]
@@ -537,7 +551,7 @@
           [ thread-compile-fail ./sync/mutual_exclusion/timed_mutex/copy_fail.cpp : : timed_mutex__copy_f ]
           [ thread-run2-noit ./sync/mutual_exclusion/timed_mutex/default_pass.cpp : timed_mutex__default_p ]
           [ thread-run2-noit ./sync/mutual_exclusion/timed_mutex/lock_pass.cpp : timed_mutex__lock_p ]
- [ thread-run2-noit ./sync/mutual_exclusion/timed_mutex/native_handle_pass.cpp : timed_mutex__native_handle_p ]
+ [ thread-run2-noit-pthread ./sync/mutual_exclusion/timed_mutex/native_handle_pass.cpp : timed_mutex__native_handle_p ]
           [ thread-run2-noit ./sync/mutual_exclusion/timed_mutex/try_lock_for_pass.cpp : timed_mutex__try_lock_for_p ]
           [ thread-run2-noit ./sync/mutual_exclusion/timed_mutex/try_lock_pass.cpp : timed_mutex__try_lock_p ]
           [ thread-run2-noit ./sync/mutual_exclusion/timed_mutex/try_lock_until_pass.cpp : timed_mutex__try_lock_until_p ]
@@ -672,6 +686,7 @@
           #[ thread-run test_7666.cpp ]
           #[ thread-run ../example/unwrap.cpp ]
           [ thread-run ../example/perf_condition_variable.cpp ]
+ #[ thread-run ../example/not_interleaved.cpp ]
     ;
 
 }

Modified: branches/release/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/cons/make_unique_locks_mutex_pass.cpp
==============================================================================
--- branches/release/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/cons/make_unique_locks_mutex_pass.cpp (original)
+++ branches/release/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/cons/make_unique_locks_mutex_pass.cpp 2013-01-10 16:38:43 EST (Thu, 10 Jan 2013)
@@ -15,7 +15,7 @@
 #include <boost/thread/thread.hpp>
 #include <boost/detail/lightweight_test.hpp>
 
-#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && ! defined BOOST_NO_CXX11_HDR_TUPLE && ! defined BOOST_NO_CXX11_RVALUE_REFERENCES
+#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && ! defined BOOST_THREAD_NO_CXX11_HDR_TUPLE && ! defined BOOST_NO_CXX11_RVALUE_REFERENCES
 
 boost::mutex m1;
 boost::mutex m2;


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