Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81814 - in branches/release: boost/thread boost/thread/v2 libs/thread libs/thread/test libs/thread/test/sync/mutual_exclusion/locks/lock_guard libs/thread/test/sync/mutual_exclusion/locks/nested_strict_lock libs/thread/test/sync/mutual_exclusion/locks/strict_lock libs/thread/test/sync/mutual_exclusion/locks/unique_lock/obs
From: vicente.botet_at_[hidden]
Date: 2012-12-10 02:37:26


Author: viboes
Date: 2012-12-10 02:37:23 EST (Mon, 10 Dec 2012)
New Revision: 81814
URL: http://svn.boost.org/trac/boost/changeset/81814

Log:
Thread: merge from trunk 1.53 strict lock tests
Added:
   branches/release/libs/thread/test/sync/mutual_exclusion/locks/nested_strict_lock/copy_assign_fail.cpp
      - copied unchanged from r81765, /trunk/libs/thread/test/sync/mutual_exclusion/locks/nested_strict_lock/copy_assign_fail.cpp
   branches/release/libs/thread/test/sync/mutual_exclusion/locks/nested_strict_lock/copy_ctor_fail.cpp
      - copied unchanged from r81765, /trunk/libs/thread/test/sync/mutual_exclusion/locks/nested_strict_lock/copy_ctor_fail.cpp
   branches/release/libs/thread/test/sync/mutual_exclusion/locks/nested_strict_lock/default_pass.cpp
      - copied unchanged from r81765, /trunk/libs/thread/test/sync/mutual_exclusion/locks/nested_strict_lock/default_pass.cpp
   branches/release/libs/thread/test/sync/mutual_exclusion/locks/nested_strict_lock/make_nested_strict_lock_pass.cpp
      - copied unchanged from r81765, /trunk/libs/thread/test/sync/mutual_exclusion/locks/nested_strict_lock/make_nested_strict_lock_pass.cpp
   branches/release/libs/thread/test/sync/mutual_exclusion/locks/nested_strict_lock/owns_lock_pass.cpp
      - copied unchanged from r81765, /trunk/libs/thread/test/sync/mutual_exclusion/locks/nested_strict_lock/owns_lock_pass.cpp
   branches/release/libs/thread/test/sync/mutual_exclusion/locks/nested_strict_lock/types_pass.cpp
      - copied unchanged from r81765, /trunk/libs/thread/test/sync/mutual_exclusion/locks/nested_strict_lock/types_pass.cpp
   branches/release/libs/thread/test/sync/mutual_exclusion/locks/strict_lock/copy_assign_fail.cpp
      - copied unchanged from r81765, /trunk/libs/thread/test/sync/mutual_exclusion/locks/strict_lock/copy_assign_fail.cpp
   branches/release/libs/thread/test/sync/mutual_exclusion/locks/strict_lock/copy_ctor_fail.cpp
      - copied unchanged from r81765, /trunk/libs/thread/test/sync/mutual_exclusion/locks/strict_lock/copy_ctor_fail.cpp
   branches/release/libs/thread/test/sync/mutual_exclusion/locks/strict_lock/default_pass.cpp
      - copied unchanged from r81765, /trunk/libs/thread/test/sync/mutual_exclusion/locks/strict_lock/default_pass.cpp
   branches/release/libs/thread/test/sync/mutual_exclusion/locks/strict_lock/make_strict_lock_pass.cpp
      - copied unchanged from r81765, /trunk/libs/thread/test/sync/mutual_exclusion/locks/strict_lock/make_strict_lock_pass.cpp
   branches/release/libs/thread/test/sync/mutual_exclusion/locks/strict_lock/owns_lock_pass.cpp
      - copied unchanged from r81765, /trunk/libs/thread/test/sync/mutual_exclusion/locks/strict_lock/owns_lock_pass.cpp
   branches/release/libs/thread/test/sync/mutual_exclusion/locks/strict_lock/types_pass.cpp
      - copied unchanged from r81765, /trunk/libs/thread/test/sync/mutual_exclusion/locks/strict_lock/types_pass.cpp
Properties modified:
   branches/release/boost/thread/ (props changed)
   branches/release/libs/thread/ (props changed)
Text files modified:
   branches/release/boost/thread/lock_concepts.hpp | 3 ++-
   branches/release/boost/thread/strict_lock.hpp | 2 +-
   branches/release/boost/thread/synchronized_value.hpp | 20 ++++++++++++++++----
   branches/release/boost/thread/v2/thread.hpp | 4 ++--
   branches/release/libs/thread/test/Jamfile.v2 | 23 +++++++++++++++++++++++
   branches/release/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/make_lock_guard_pass.cpp | 4 +---
   branches/release/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/obs/owns_lock_pass.cpp | 3 ++-
   7 files changed, 47 insertions(+), 12 deletions(-)

Modified: branches/release/boost/thread/lock_concepts.hpp
==============================================================================
--- branches/release/boost/thread/lock_concepts.hpp (original)
+++ branches/release/boost/thread/lock_concepts.hpp 2012-12-10 02:37:23 EST (Mon, 10 Dec 2012)
@@ -14,6 +14,7 @@
 
 #include <boost/chrono/chrono.hpp>
 #include <boost/concept_check.hpp>
+#include <boost/static_assert.hpp>
 
 namespace boost
 {
@@ -174,7 +175,7 @@
   {
     typedef typename Lk::mutex_type mutex_type;
     BOOST_CONCEPT_ASSERT(( BasicLockable<mutex_type> ));
- BOOST_STATIC_ASSERT(( is_strict_lock<Lk>::value));
+ BOOST_STATIC_ASSERT(( is_strict_lock<Lk>::value ));
 
     BOOST_CONCEPT_USAGE( StrictLock)
     {

Modified: branches/release/boost/thread/strict_lock.hpp
==============================================================================
--- branches/release/boost/thread/strict_lock.hpp (original)
+++ branches/release/boost/thread/strict_lock.hpp 2012-12-10 02:37:23 EST (Mon, 10 Dec 2012)
@@ -8,12 +8,12 @@
 
 #include <boost/thread/detail/delete.hpp>
 #include <boost/thread/lock_options.hpp>
-//#include <boost/thread/is_locked_by_this_thread.hpp>
 #include <boost/thread/lock_traits.hpp>
 #include <boost/thread/lockable_traits.hpp>
 #include <boost/thread/lockable_concepts.hpp>
 #include <boost/thread/lock_concepts.hpp>
 #include <boost/thread/exceptions.hpp>
+#include <boost/throw_exception.hpp>
 
 #include <boost/config/abi_prefix.hpp>
 

Modified: branches/release/boost/thread/synchronized_value.hpp
==============================================================================
--- branches/release/boost/thread/synchronized_value.hpp (original)
+++ branches/release/boost/thread/synchronized_value.hpp 2012-12-10 02:37:23 EST (Mon, 10 Dec 2012)
@@ -59,7 +59,7 @@
     /**
      * Move Constructor from movable value.
      *
- * Requires: T is CopyConstructible
+ * Requires: T is Movable
      */
     synchronized_value(BOOST_THREAD_RV_REF(T) other)
     : value_(boost::move(other))
@@ -303,7 +303,7 @@
     struct unique_synchronizer : unique_lock<lockable_type>
     {
     private:
- friend class synchronized_value;
+ //friend class synchronized_value;
       typedef unique_lock<lockable_type> base_type;
 
       T& value_;
@@ -315,6 +315,18 @@
       : base_type(outer.mtx_), value_(outer.value_)
       {
       }
+ unique_synchronizer(synchronized_value& outer, adopt_lock_t)
+ : base_type(outer.mtx_, adopt_lock), value_(outer.value_)
+ {
+ }
+ unique_synchronizer(synchronized_value& outer, defer_lock_t)
+ : base_type(outer.mtx_, defer_lock), value_(outer.value_)
+ {
+ }
+ unique_synchronizer(synchronized_value& outer, try_to_lock_t)
+ : base_type(outer.mtx_, try_to_lock), value_(outer.value_)
+ {
+ }
       unique_synchronizer(BOOST_THREAD_RV_REF(unique_synchronizer) other)
       : base_type(boost::move(other)),value_(BOOST_THREAD_RV(other).value_)
       {
@@ -335,9 +347,9 @@
       const T* operator->() const
       {
         if (this->owns_lock())
- return &value_;
+ return &value_;
         else
- return 0;
+ return 0;
       }
 
       T& operator*()

Modified: branches/release/boost/thread/v2/thread.hpp
==============================================================================
--- branches/release/boost/thread/v2/thread.hpp (original)
+++ branches/release/boost/thread/v2/thread.hpp 2012-12-10 02:37:23 EST (Mon, 10 Dec 2012)
@@ -40,7 +40,7 @@
       using namespace chrono;
       if (d > duration<Rep, Period>::zero())
       {
- duration<long double> Max = nanoseconds::max();
+ duration<long double> Max = nanoseconds::max BOOST_PREVENT_MACRO_SUBSTITUTION ();
           nanoseconds ns;
           if (d < Max)
           {
@@ -49,7 +49,7 @@
                   ++ns;
           }
           else
- ns = nanoseconds::max();
+ ns = nanoseconds:: max BOOST_PREVENT_MACRO_SUBSTITUTION ();
           sleep_for(ns);
       }
     }

Modified: branches/release/libs/thread/test/Jamfile.v2
==============================================================================
--- branches/release/libs/thread/test/Jamfile.v2 (original)
+++ branches/release/libs/thread/test/Jamfile.v2 2012-12-10 02:37:23 EST (Mon, 10 Dec 2012)
@@ -472,6 +472,29 @@
           [ thread-run2-noit ./sync/mutual_exclusion/locks/upgrade_lock/types_pass.cpp : upgrade_lock__types_p ]
     ;
 
+ #explicit ts_strict_lock ;
+ test-suite ts_strict_lock
+ :
+ [ thread-compile-fail ./sync/mutual_exclusion/locks/strict_lock/copy_assign_fail.cpp : : strict_lock__cons__copy_assign_f ]
+ [ thread-compile-fail ./sync/mutual_exclusion/locks/strict_lock/copy_ctor_fail.cpp : : strict_lock__cons__copy_ctor_f ]
+ [ thread-run2-noit ./sync/mutual_exclusion/locks/strict_lock/default_pass.cpp : strict_lock__cons__default_p ]
+ [ thread-run2-noit ./sync/mutual_exclusion/locks/strict_lock/owns_lock_pass.cpp : strict_lock__owns_lock_p ]
+ [ thread-run2-noit ./sync/mutual_exclusion/locks/strict_lock/types_pass.cpp : strict_lock__types_p ]
+ #[ thread-run2-noit ./sync/mutual_exclusion/locks/strict_lock/make_strict_lock_pass.cpp : make_strict_lock_p ]
+ ;
+
+ #explicit ts_nested_strict_lock ;
+ test-suite ts_nested_strict_lock
+ :
+ [ thread-compile-fail ./sync/mutual_exclusion/locks/nested_strict_lock/copy_assign_fail.cpp : : nested_strict_lock__cons__copy_assign_f ]
+ [ thread-compile-fail ./sync/mutual_exclusion/locks/nested_strict_lock/copy_ctor_fail.cpp : : nested_strict_lock__cons__copy_ctor_f ]
+ [ thread-run2-noit ./sync/mutual_exclusion/locks/nested_strict_lock/default_pass.cpp : nested_strict_lock__cons__default_p ]
+ [ thread-run2-noit ./sync/mutual_exclusion/locks/nested_strict_lock/owns_lock_pass.cpp : nested_strict_lock__owns_lock_p ]
+ [ thread-run2-noit ./sync/mutual_exclusion/locks/nested_strict_lock/types_pass.cpp : nested_strict_lock__types_p ]
+ #[ thread-run2-noit ./sync/mutual_exclusion/locks/nested_strict_lock/make_nested_strict_lock_pass.cpp : make_nested_strict_lock_p ]
+ ;
+
+
     #explicit ts_mutex ;
     test-suite ts_mutex
     :

Modified: branches/release/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/make_lock_guard_pass.cpp
==============================================================================
--- branches/release/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/make_lock_guard_pass.cpp (original)
+++ branches/release/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/make_lock_guard_pass.cpp 2012-12-10 02:37:23 EST (Mon, 10 Dec 2012)
@@ -38,7 +38,7 @@
 
 boost::mutex m;
 
-#if ! defined(BOOST_NO_CXX11_AUTO) && ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && ! defined BOOST_NO_CXX11_HDR_INITIALIZER_LIST
+#if ! defined(BOOST_NO_CXX11_AUTO) && ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && ! defined BOOST_NO_CXX11_HDR_INITIALIZER_LIST && defined BOOST_THREAD_USES_CHRONO
 
 void f()
 {
@@ -63,9 +63,7 @@
   {
     m.lock();
     boost::thread t(f);
- #ifdef BOOST_THREAD_USES_CHRONO
     boost::this_thread::sleep_for(ms(250));
- #endif
     m.unlock();
     t.join();
   }

Modified: branches/release/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/obs/owns_lock_pass.cpp
==============================================================================
--- branches/release/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/obs/owns_lock_pass.cpp (original)
+++ branches/release/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/obs/owns_lock_pass.cpp 2012-12-10 02:37:23 EST (Mon, 10 Dec 2012)
@@ -22,10 +22,11 @@
 #include <boost/thread/mutex.hpp>
 #include <boost/detail/lightweight_test.hpp>
 
-boost::mutex m;
 
 int main()
 {
+ boost::mutex m;
+
   boost::unique_lock<boost::mutex> lk0;
   BOOST_TEST(lk0.owns_lock() == false);
   boost::unique_lock<boost::mutex> lk1(m);


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