Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81106 - in trunk: boost/thread boost/thread/detail boost/thread/pthread boost/thread/v2 boost/thread/win32 libs/thread/example libs/thread/src/pthread libs/thread/src/win32
From: vicente.botet_at_[hidden]
Date: 2012-10-29 15:57:04


Author: viboes
Date: 2012-10-29 15:57:01 EDT (Mon, 29 Oct 2012)
New Revision: 81106
URL: http://svn.boost.org/trac/boost/changeset/81106

Log:
Thread Split lock.hpp + towards allowing to disable interruptions
Text files modified:
   trunk/boost/thread/detail/config.hpp | 81 +
   trunk/boost/thread/detail/thread.hpp | 8
   trunk/boost/thread/detail/thread_group.hpp | 21
   trunk/boost/thread/detail/thread_interruption.hpp | 5
   trunk/boost/thread/exceptions.hpp | 2
   trunk/boost/thread/externally_locked.hpp | 51
   trunk/boost/thread/future.hpp | 33
   trunk/boost/thread/locks.hpp | 1826 ---------------------------------------
   trunk/boost/thread/pthread/condition_variable.hpp | 18
   trunk/boost/thread/pthread/condition_variable_fwd.hpp | 2
   trunk/boost/thread/pthread/mutex.hpp | 59
   trunk/boost/thread/pthread/recursive_mutex.hpp | 8
   trunk/boost/thread/pthread/shared_mutex.hpp | 78 +
   trunk/boost/thread/pthread/thread_data.hpp | 9
   trunk/boost/thread/reverse_lock.hpp | 5
   trunk/boost/thread/shared_lock_guard.hpp | 3
   trunk/boost/thread/thread.hpp | 2
   trunk/boost/thread/v2/thread.hpp | 2
   trunk/boost/thread/win32/condition_variable.hpp | 2
   trunk/boost/thread/win32/mutex.hpp | 9
   trunk/boost/thread/win32/recursive_mutex.hpp | 8
   trunk/boost/thread/win32/thread_data.hpp | 12
   trunk/libs/thread/example/shared_monitor.cpp | 1
   trunk/libs/thread/example/shared_mutex.cpp | 1
   trunk/libs/thread/src/pthread/thread.cpp | 14
   trunk/libs/thread/src/win32/thread.cpp | 20
   26 files changed, 361 insertions(+), 1919 deletions(-)

Modified: trunk/boost/thread/detail/config.hpp
==============================================================================
--- trunk/boost/thread/detail/config.hpp (original)
+++ trunk/boost/thread/detail/config.hpp 2012-10-29 15:57:01 EDT (Mon, 29 Oct 2012)
@@ -16,7 +16,6 @@
 #include <boost/config.hpp>
 #include <boost/detail/workaround.hpp>
 #include <boost/thread/detail/platform.hpp>
-#include <boost/detail/no_exceptions_support.hpp>
 
 #if ! defined BOOST_THREAD_NOEXCEPT_OR_THROW
 #ifdef BOOST_NO_NOEXCEPT
@@ -29,6 +28,7 @@
 // This compiler doesn't support Boost.Chrono
 #if defined __IBMCPP__ && (__IBMCPP__ < 1100) && ! defined BOOST_THREAD_DONT_USE_CHRONO
 #define BOOST_THREAD_DONT_USE_CHRONO
+#define BOOST_THREAD_USE_DATE
 #endif
 
 // This compiler doesn't support Boost.Move
@@ -51,37 +51,34 @@
 
 // Default version is 2
 #if !defined BOOST_THREAD_VERSION
-#define BOOST_THREAD_VERSION 2
+#define BOOST_THREAD_VERSION 3
 #else
 #if BOOST_THREAD_VERSION!=2 && BOOST_THREAD_VERSION!=3 && BOOST_THREAD_VERSION!=4
 #error "BOOST_THREAD_VERSION must be 2, 3 or 4"
 #endif
 #endif
 
+// CHRONO
 // Uses Boost.Chrono by default if not stated the opposite defining BOOST_THREAD_DONT_USE_CHRONO
 #if ! defined BOOST_THREAD_DONT_USE_CHRONO && ! defined BOOST_THREAD_USES_CHRONO
 #define BOOST_THREAD_USES_CHRONO
 #endif
 
-// Don't provided by default in version 1.
-#if defined BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
-#define BOOST_THREAD_EXPLICIT_LOCK_CONVERSION explicit
-#else
-#define BOOST_THREAD_EXPLICIT_LOCK_CONVERSION
-#endif
-
-
 #if BOOST_THREAD_VERSION==2
+
+// PROVIDE_PROMISE_LAZY
 #if ! defined BOOST_THREAD_DONT_PROVIDE_PROMISE_LAZY \
   && ! defined BOOST_THREAD_PROMISE_LAZY
 #define BOOST_THREAD_PROMISE_LAZY
 #endif
 
+// PROVIDE_THREAD_EQ
 #if ! defined BOOST_THREAD_DONT_PROVIDE_THREAD_EQ \
   && ! defined BOOST_THREAD_PROVIDES_THREAD_EQ
 #define BOOST_THREAD_PROVIDES_THREAD_EQ
 #endif
 
+// USE_DATETIME
 #if ! defined BOOST_THREAD_DONT_USE_DATETIME \
  && ! defined BOOST_THREAD_USES_DATETIME
 #define BOOST_THREAD_USES_DATETIME
@@ -90,38 +87,56 @@
 #endif
 
 #if BOOST_THREAD_VERSION>=3
+
+// ONCE_CXX11
 #if ! defined BOOST_THREAD_DONT_PROVIDE_ONCE_CXX11 \
  && ! defined BOOST_THREAD_PROVIDES_ONCE_CXX11
 #define BOOST_THREAD_PROVIDES_ONCE_CXX11
 #endif
+
+// THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE
 #if ! defined BOOST_THREAD_DONT_PROVIDE_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE \
  && ! defined BOOST_THREAD_PROVIDES_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE
 #define BOOST_THREAD_PROVIDES_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE
 #endif
+
+// THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE
 #if ! defined BOOST_THREAD_DONT_PROVIDE_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE \
  && ! defined BOOST_THREAD_PROVIDES_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE
 #define BOOST_THREAD_PROVIDES_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE
 #endif
+
+// PROVIDE_FUTURE
 #if ! defined BOOST_THREAD_DONT_PROVIDE_FUTURE \
  && ! defined BOOST_THREAD_PROVIDES_FUTURE
 #define BOOST_THREAD_PROVIDES_FUTURE
 #endif
+
+// FUTURE_CTOR_ALLOCATORS
 #if ! defined BOOST_THREAD_DONT_PROVIDE_FUTURE_CTOR_ALLOCATORS \
  && ! defined BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS
 #define BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS
 #endif
+
+// SHARED_MUTEX_UPWARDS_CONVERSIONS
 #if ! defined BOOST_THREAD_DONT_PROVIDE_SHARED_MUTEX_UPWARDS_CONVERSIONS \
  && ! defined BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS
 #define BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS
 #endif
+
+// PROVIDE_EXPLICIT_LOCK_CONVERSION
 #if ! defined BOOST_THREAD_DONT_PROVIDE_EXPLICIT_LOCK_CONVERSION \
  && ! defined BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
 #define BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
 #endif
+
+// GENERIC_SHARED_MUTEX_ON_WIN
 #if ! defined BOOST_THREAD_DONT_PROVIDE_GENERIC_SHARED_MUTEX_ON_WIN \
  && ! defined BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN
 #define BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN
 #endif
+
+// USE_MOVE
 #if ! defined BOOST_THREAD_DONT_USE_MOVE \
  && ! defined BOOST_THREAD_USES_MOVE
 #define BOOST_THREAD_USES_MOVE
@@ -129,13 +144,32 @@
 
 #endif
 
+// deprecated since version 4
+#if BOOST_THREAD_VERSION < 4
+
+// NESTED_LOCKS
+#if ! defined BOOST_THREAD_PROVIDES_NESTED_LOCKS \
+ && ! defined BOOST_THREAD_DONT_PROVIDE_NESTED_LOCKS
+#define BOOST_THREAD_PROVIDES_NESTED_LOCKS
+#endif
+
+// CONDITION
+#if ! defined BOOST_THREAD_PROVIDES_CONDITION \
+ && ! defined BOOST_THREAD_DONT_PROVIDE_CONDITION
+#define BOOST_THREAD_PROVIDES_CONDITION
+#endif
+
+#endif
+
 #if BOOST_THREAD_VERSION>=4
 
+// SIGNATURE_PACKAGED_TASK
 #if ! defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK \
  && ! defined BOOST_THREAD_DONT_PROVIDE_SIGNATURE_PACKAGED_TASK
 #define BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK
 #endif
 
+// VARIADIC_THREAD
 #if ! defined BOOST_THREAD_PROVIDES_VARIADIC_THREAD \
  && ! defined BOOST_THREAD_DONT_PROVIDE_VARIADIC_THREAD
 
@@ -144,10 +178,12 @@
     ! defined(BOOST_NO_CXX11_DECLTYPE) && \
     ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \
     ! defined(BOOST_NO_CXX11_HDR_TUPLE)
+
 #define BOOST_THREAD_PROVIDES_VARIADIC_THREAD
 #endif
 #endif
 
+// FUTURE_CONTINUATION
 #if ! defined BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION \
  && ! defined BOOST_THREAD_DONT_PROVIDE_FUTURE_CONTINUATION
 
@@ -156,16 +192,41 @@
 #endif
 #endif
 
+// FUTURE_INVALID_AFTER_GET
 #if ! defined BOOST_THREAD_PROVIDES_FUTURE_INVALID_AFTER_GET \
  && ! defined BOOST_THREAD_DONT_PROVIDE_FUTURE_INVALID_AFTER_GET
 #define BOOST_THREAD_PROVIDES_FUTURE_INVALID_AFTER_GET
 #endif
 
+// NESTED_LOCKS
+#if ! defined BOOST_THREAD_PROVIDES_NESTED_LOCKS \
+ && ! defined BOOST_THREAD_DONT_PROVIDE_NESTED_LOCKS
+#define BOOST_THREAD_DONT_PROVIDE_NESTED_LOCKS
+#endif
+
+// CONDITION
+#if ! defined BOOST_THREAD_PROVIDES_CONDITION \
+ && ! defined BOOST_THREAD_DONT_PROVIDE_CONDITION
+#define BOOST_THREAD_DONT_PROVIDE_CONDITION
+#endif
+
 #endif // BOOST_THREAD_VERSION>=4
 
+// INTERRUPTIONS
+#if ! defined BOOST_THREAD_PROVIDES_INTERRUPTIONS \
+ && ! defined BOOST_THREAD_DONT_PROVIDE_INTERRUPTIONS
+#define BOOST_THREAD_PROVIDES_INTERRUPTIONS
+#endif
 
 // CORRELATIONS
 
+// EXPLICIT_LOCK_CONVERSION.
+#if defined BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
+#define BOOST_THREAD_EXPLICIT_LOCK_CONVERSION explicit
+#else
+#define BOOST_THREAD_EXPLICIT_LOCK_CONVERSION
+#endif
+
 // BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN is defined if BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS
 #if defined BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS \
 && ! defined BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN

Modified: trunk/boost/thread/detail/thread.hpp
==============================================================================
--- trunk/boost/thread/detail/thread.hpp (original)
+++ trunk/boost/thread/detail/thread.hpp 2012-10-29 15:57:01 EDT (Mon, 29 Oct 2012)
@@ -16,6 +16,7 @@
 // The code taking care of thread creation and invoke have been taken from libcxx.
 //===----------------------------------------------------------------------===//
 #include <boost/thread/detail/config.hpp>
+
 #include <boost/thread/exceptions.hpp>
 #ifndef BOOST_NO_IOSTREAM
 #include <ostream>
@@ -632,21 +633,23 @@
         bool operator==(const thread& other) const;
         bool operator!=(const thread& other) const;
 #endif
+#if defined BOOST_THREAD_USES_DATETIME
         static inline void yield() BOOST_NOEXCEPT
         {
             this_thread::yield();
         }
 
-#if defined BOOST_THREAD_USES_DATETIME
         static inline void sleep(const system_time& xt)
         {
             this_thread::sleep(xt);
         }
 #endif
 
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
         // extensions
         void interrupt();
         bool interruption_requested() const BOOST_NOEXCEPT;
+#endif
     };
 
     inline void swap(thread& lhs,thread& rhs) BOOST_NOEXCEPT
@@ -671,9 +674,11 @@
         thread::id BOOST_THREAD_DECL get_id() BOOST_NOEXCEPT;
 #endif
 
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
         void BOOST_THREAD_DECL interruption_point();
         bool BOOST_THREAD_DECL interruption_enabled() BOOST_NOEXCEPT;
         bool BOOST_THREAD_DECL interruption_requested() BOOST_NOEXCEPT;
+#endif
 
 #if defined BOOST_THREAD_USES_DATETIME
         inline BOOST_SYMBOL_VISIBLE void sleep(xtime const& abs_time)
@@ -851,7 +856,6 @@
 #ifdef BOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED
             boost::throw_exception(thread_resource_error(system::errc::invalid_argument, "boost thread: thread not joinable"));
 #endif
- return false;
         }
     }
 

Modified: trunk/boost/thread/detail/thread_group.hpp
==============================================================================
--- trunk/boost/thread/detail/thread_group.hpp (original)
+++ trunk/boost/thread/detail/thread_group.hpp 2012-10-29 15:57:01 EDT (Mon, 29 Oct 2012)
@@ -8,6 +8,7 @@
 #include <list>
 #include <boost/thread/shared_mutex.hpp>
 #include <boost/thread/mutex.hpp>
+#include <boost/thread/lock_guard.hpp>
 
 #include <boost/config/abi_prefix.hpp>
 
@@ -22,7 +23,7 @@
     {
     private:
         thread_group(thread_group const&);
- thread_group& operator=(thread_group const&);
+ thread_group& operator=(thread_group const&);
     public:
         thread_group() {}
         ~thread_group()
@@ -43,7 +44,7 @@
             threads.push_back(new_thread.get());
             return new_thread.release();
         }
-
+
         void add_thread(thread* thrd)
         {
             if(thrd)
@@ -52,7 +53,7 @@
                 threads.push_back(thrd);
             }
         }
-
+
         void remove_thread(thread* thrd)
         {
             boost::lock_guard<shared_mutex> guard(m);
@@ -62,11 +63,11 @@
                 threads.erase(it);
             }
         }
-
+
         void join_all()
         {
             boost::shared_lock<shared_mutex> guard(m);
-
+
             for(std::list<thread*>::iterator it=threads.begin(),end=threads.end();
                 it!=end;
                 ++it)
@@ -74,11 +75,12 @@
                 (*it)->join();
             }
         }
-
+
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
         void interrupt_all()
         {
             boost::shared_lock<shared_mutex> guard(m);
-
+
             for(std::list<thread*>::iterator it=threads.begin(),end=threads.end();
                 it!=end;
                 ++it)
@@ -86,13 +88,14 @@
                 (*it)->interrupt();
             }
         }
-
+#endif
+
         size_t size() const
         {
             boost::shared_lock<shared_mutex> guard(m);
             return threads.size();
         }
-
+
     private:
         std::list<thread*> threads;
         mutable shared_mutex m;

Modified: trunk/boost/thread/detail/thread_interruption.hpp
==============================================================================
--- trunk/boost/thread/detail/thread_interruption.hpp (original)
+++ trunk/boost/thread/detail/thread_interruption.hpp 2012-10-29 15:57:01 EDT (Mon, 29 Oct 2012)
@@ -9,6 +9,8 @@
 #include <boost/thread/detail/config.hpp>
 #include <boost/thread/detail/delete.hpp>
 
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
+
 namespace boost
 {
     namespace this_thread
@@ -33,4 +35,5 @@
     }
 }
 
-#endif
+#endif // BOOST_THREAD_PROVIDES_INTERRUPTIONS
+#endif // header

Modified: trunk/boost/thread/exceptions.hpp
==============================================================================
--- trunk/boost/thread/exceptions.hpp (original)
+++ trunk/boost/thread/exceptions.hpp 2012-10-29 15:57:01 EDT (Mon, 29 Oct 2012)
@@ -28,8 +28,10 @@
 namespace boost
 {
 
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
     class BOOST_SYMBOL_VISIBLE thread_interrupted
     {};
+#endif
 
     class BOOST_SYMBOL_VISIBLE thread_exception:
         public system::system_error

Modified: trunk/boost/thread/externally_locked.hpp
==============================================================================
--- trunk/boost/thread/externally_locked.hpp (original)
+++ trunk/boost/thread/externally_locked.hpp 2012-10-29 15:57:01 EDT (Mon, 29 Oct 2012)
@@ -89,7 +89,7 @@
     {
 
 #ifndef BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME /*< define BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME if you don't want to check lk check the same mtx >*/
- if (lk.mutex()!=mtx_) throw lock_error(); /*< run time check throw if not locks the same >*/
+ if (!lk.owns_lock(mtx_)) throw lock_error(); /*< run time check throw if not locks the same >*/
 #endif
       return obj_;
     }
@@ -98,7 +98,7 @@
     {
 
 #ifndef BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME /*< define BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME if you don't want to check lk check the same mtx >*/
- if (lk.mutex()!=mtx_) throw lock_error(); /*< run time check throw if not locks the same >*/
+ if (!lk.owns_lock(mtx_)) throw lock_error(); /*< run time check throw if not locks the same >*/
 #endif
       return obj_;
     }
@@ -109,7 +109,7 @@
       BOOST_STATIC_ASSERT( (is_same<mutex_type, typename Lock::mutex_type>::value)); /*< that locks the same type >*/
 
 #ifndef BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME /*< define BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME if you don't want to check lk check the same mtx >*/
- if (lk.mutex()!=mtx_) throw lock_error(); /*< run time check throw if not locks the same >*/
+ if (!lk.owns_lock(mtx_)) throw lock_error(); /*< run time check throw if not locks the same >*/
 #endif
       return obj_;
     }
@@ -120,7 +120,7 @@
       BOOST_STATIC_ASSERT( (is_same<mutex_type, typename Lock::mutex_type>::value)); /*< that locks the same type >*/
 
 #ifndef BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME /*< define BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME if you don't want to check lk check the same mtx >*/
- if (lk.mutex()!=mtx_) throw lock_error(); /*< run time check throw if not locks the same >*/
+ if (!lk.owns_lock(mtx_)) throw lock_error(); /*< run time check throw if not locks the same >*/
 #endif
       return obj_;
     }
@@ -142,7 +142,7 @@
       if (!lk.own_lock()) throw lock_error(); /*< run time check throw if no locked >*/
 #endif
 #ifndef BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME
- if (lk.mutex()!=mtx_) throw lock_error();
+ if (!lk.owns_lock(mtx_)) throw lock_error();
 #endif
       return obj_;
     }
@@ -220,42 +220,42 @@
      *
      * Throws: lock_error if BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME is not defined and the lk parameter doesn't satisfy the preconditions
      */
- T& get(strict_lock<mutex_type>& lk)
+ T& get(strict_lock<mutex_type> const& lk)
     {
 
 #ifndef BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME /*< define BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME if you don't want to check lk check the same mtx >*/
- if (lk.mutex()!=mtx_) throw lock_error(); /*< run time check throw if not locks the same >*/
+ if (!lk.owns_lock(mtx_)) throw lock_error(); /*< run time check throw if not locks the same >*/
 #endif
       return *obj_;
     }
 
- const T& get(strict_lock<mutex_type>& lk) const
+ const T& get(strict_lock<mutex_type> const& lk) const
     {
 
 #ifndef BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME /*< define BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME if you don't want to check lk check the same mtx >*/
- if (lk.mutex()!=mtx_) throw lock_error(); /*< run time check throw if not locks the same >*/
+ if (!lk.owns_lock(mtx_)) throw lock_error(); /*< run time check throw if not locks the same >*/
 #endif
       return *obj_;
     }
 
     template <class Lock>
- T& get(nested_strict_lock<Lock>& lk)
+ T& get(nested_strict_lock<Lock> const& lk)
     {
       BOOST_STATIC_ASSERT( (is_same<mutex_type, typename Lock::mutex_type>::value)); /*< that locks the same type >*/
 
 #ifndef BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME /*< define BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME if you don't want to check lk check the same mtx >*/
- if (lk.mutex()!=mtx_) throw lock_error(); /*< run time check throw if not locks the same >*/
+ if (!lk.owns_lock(mtx_)) throw lock_error(); /*< run time check throw if not locks the same >*/
 #endif
       return *obj_;
     }
 
     template <class Lock>
- const T& get(nested_strict_lock<Lock>& lk) const
+ const T& get(nested_strict_lock<Lock> const& lk) const
     {
       BOOST_STATIC_ASSERT( (is_same<mutex_type, typename Lock::mutex_type>::value)); /*< that locks the same type >*/
 
 #ifndef BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME /*< define BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME if you don't want to check lk check the same mtx >*/
- if (!lk.is_locking(&mtx_)) throw lock_error(); /*< run time check throw if not locks the same >*/
+ if (!lk.owns_lock(&mtx_)) throw lock_error(); /*< run time check throw if not locks the same >*/
 #endif
       return *obj_;
     }
@@ -267,7 +267,7 @@
      * Throws: lock_error if BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME is not defined and the lk parameter doesn't satisfy the preconditions
      */
     template <class Lock>
- T& get(Lock& lk)
+ T& get(Lock const& lk)
     {
       BOOST_CONCEPT_ASSERT(( StrictLock<Lock> ));
       BOOST_STATIC_ASSERT( (is_strict_lock<Lock>::value)); /*< lk is a strict lock "sur parolle" >*/
@@ -277,11 +277,32 @@
       if (!lk.own_lock()) throw lock_error(); /*< run time check throw if no locked >*/
 #endif
 #ifndef BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME
- if (lk.mutex()!=mtx_) throw lock_error();
+ if (!lk.owns_lock(mtx_)) throw lock_error();
 #endif
       return *obj_;
     }
 
+ /**
+ * Requires: The lk parameter must be locking the associated mtx.
+ * Returns: The address of the cloaked object..
+ *
+ * Throws: lock_error if BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME is not defined and the lk parameter doesn't satisfy the preconditions
+ */
+ template <class Lock>
+ T const& get(Lock const& lk) const
+ {
+ BOOST_CONCEPT_ASSERT(( StrictLock<Lock> ));
+ BOOST_STATIC_ASSERT( (is_strict_lock<Lock>::value)); /*< lk is a strict lock "sur parolle" >*/
+ BOOST_STATIC_ASSERT( (is_same<mutex_type, typename Lock::mutex_type>::value)); /*< that locks the same type >*/
+
+#ifndef BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_OWNERSHIP /*< define BOOST_THREAD_EXTERNALLY_LOCKED_NO_CHECK_OWNERSHIP if you don't want to check lock ownership >*/
+ if (!lk.own_lock()) throw lock_error(); /*< run time check throw if no locked >*/
+#endif
+#ifndef BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME
+ if (!lk.owns_lock(mtx_)) throw lock_error();
+#endif
+ return *obj_;
+ }
     mutex_type* mutex()
     {
       return mtx_;

Modified: trunk/boost/thread/future.hpp
==============================================================================
--- trunk/boost/thread/future.hpp (original)
+++ trunk/boost/thread/future.hpp 2012-10-29 15:57:01 EDT (Mon, 29 Oct 2012)
@@ -21,9 +21,8 @@
 #include <boost/thread/thread_time.hpp>
 #include <boost/thread/mutex.hpp>
 #include <boost/thread/condition_variable.hpp>
-#include <boost/thread/locks.hpp>
-//#include <boost/thread/lock_algorithms.hpp>
-//#include <boost/thread/lock_types.hpp>
+#include <boost/thread/lock_algorithms.hpp>
+#include <boost/thread/lock_types.hpp>
 #include <boost/exception_ptr.hpp>
 #include <boost/shared_ptr.hpp>
 #include <boost/scoped_ptr.hpp>
@@ -260,7 +259,9 @@
         {
             boost::exception_ptr exception;
             bool done;
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
             bool thread_was_interrupted;
+#endif
             boost::mutex mutex;
             boost::condition_variable waiters;
             typedef std::list<boost::condition_variable_any*> waiter_list;
@@ -272,7 +273,9 @@
 
             future_object_base():
                 done(false),
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
                 thread_was_interrupted(false)
+#endif
 #if defined BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION
                , continuation_ptr()
 #endif
@@ -344,10 +347,12 @@
                 {
                     waiters.wait(lock);
                 }
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
                 if(rethrow && thread_was_interrupted)
                 {
                     throw boost::thread_interrupted();
                 }
+#endif
                 if(rethrow && exception)
                 {
                     boost::rethrow_exception(exception);
@@ -405,21 +410,31 @@
                 boost::unique_lock<boost::mutex> lock(mutex);
                 mark_exceptional_finish_internal(boost::current_exception(), lock);
             }
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
             void mark_interrupted_finish()
             {
                 boost::unique_lock<boost::mutex> lock(mutex);
                 thread_was_interrupted=true;
                 mark_finished_internal(lock);
             }
+#endif
             bool has_value()
             {
                 boost::lock_guard<boost::mutex> lock(mutex);
- return done && !(exception || thread_was_interrupted);
+ return done && !(exception
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
+ || thread_was_interrupted
+#endif
+ );
             }
             bool has_exception()
             {
                 boost::lock_guard<boost::mutex> lock(mutex);
- return done && (exception || thread_was_interrupted);
+ return done && (exception
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
+ || thread_was_interrupted
+#endif
+);
             }
 
             template<typename F,typename U>
@@ -1590,10 +1605,12 @@
                     this->mark_finished_with_result(f());
                 }
 #endif
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
                 catch(thread_interrupted& )
                 {
                     this->mark_interrupted_finish();
                 }
+#endif
                 catch(...)
                 {
                     this->mark_exceptional_finish();
@@ -1639,10 +1656,12 @@
                         this->mark_finished_with_result(f());
                     }
 #endif
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
                     catch(thread_interrupted& )
                     {
                         this->mark_interrupted_finish();
                     }
+#endif
                     catch(...)
                     {
                         this->mark_exceptional_finish();
@@ -1698,10 +1717,12 @@
 #endif
                     this->mark_finished_with_result();
                 }
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
                 catch(thread_interrupted& )
                 {
                     this->mark_interrupted_finish();
                 }
+#endif
                 catch(...)
                 {
                     this->mark_exceptional_finish();
@@ -1747,10 +1768,12 @@
 #endif
                   this->mark_finished_with_result();
                 }
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
                 catch(thread_interrupted& )
                 {
                     this->mark_interrupted_finish();
                 }
+#endif
                 catch(...)
                 {
                     this->mark_exceptional_finish();

Modified: trunk/boost/thread/locks.hpp
==============================================================================
--- trunk/boost/thread/locks.hpp (original)
+++ trunk/boost/thread/locks.hpp 2012-10-29 15:57:01 EDT (Mon, 29 Oct 2012)
@@ -6,1827 +6,11 @@
 
 #ifndef BOOST_THREAD_LOCKS_HPP
 #define BOOST_THREAD_LOCKS_HPP
-#include <boost/thread/detail/config.hpp>
-#include <boost/thread/exceptions.hpp>
-#include <boost/thread/detail/move.hpp>
-#include <algorithm>
-#include <iterator>
-#include <boost/thread/thread_time.hpp>
-#include <boost/detail/workaround.hpp>
-#include <boost/type_traits/is_class.hpp>
-#ifdef BOOST_THREAD_USES_CHRONO
-#include <boost/chrono/time_point.hpp>
-#include <boost/chrono/duration.hpp>
-#endif
-
-#include <boost/config/abi_prefix.hpp>
-
-namespace boost
-{
- struct xtime;
-
-#if defined(BOOST_NO_SFINAE) || \
- BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) || \
- BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
-#define BOOST_THREAD_NO_AUTO_DETECT_MUTEX_TYPES
-#endif
-
-#ifndef BOOST_THREAD_NO_AUTO_DETECT_MUTEX_TYPES
- namespace detail
- {
-#define BOOST_DEFINE_HAS_MEMBER_CALLED(member_name) \
- template<typename T, bool=boost::is_class<T>::value> \
- struct has_member_called_##member_name \
- { \
- BOOST_STATIC_CONSTANT(bool, value=false); \
- }; \
- \
- template<typename T> \
- struct has_member_called_##member_name<T,true> \
- { \
- typedef char true_type; \
- struct false_type \
- { \
- true_type dummy[2]; \
- }; \
- \
- struct fallback { int member_name; }; \
- struct derived: \
- T, fallback \
- { \
- derived(); \
- }; \
- \
- template<int fallback::*> struct tester; \
- \
- template<typename U> \
- static false_type has_member(tester<&U::member_name>*); \
- template<typename U> \
- static true_type has_member(...); \
- \
- BOOST_STATIC_CONSTANT( \
- bool, value=sizeof(has_member<derived>(0))==sizeof(true_type)); \
- }
-
- BOOST_DEFINE_HAS_MEMBER_CALLED(lock);
- BOOST_DEFINE_HAS_MEMBER_CALLED(unlock);
- BOOST_DEFINE_HAS_MEMBER_CALLED(try_lock);
-
- template<typename T,bool=has_member_called_lock<T>::value >
- struct has_member_lock
- {
- BOOST_STATIC_CONSTANT(bool, value=false);
- };
-
- template<typename T>
- struct has_member_lock<T,true>
- {
- typedef char true_type;
- struct false_type
- {
- true_type dummy[2];
- };
-
- template<typename U,typename V>
- static true_type has_member(V (U::*)());
- template<typename U>
- static false_type has_member(U);
-
- BOOST_STATIC_CONSTANT(
- bool,value=sizeof(has_member_lock<T>::has_member(&T::lock))==sizeof(true_type));
- };
-
- template<typename T,bool=has_member_called_unlock<T>::value >
- struct has_member_unlock
- {
- BOOST_STATIC_CONSTANT(bool, value=false);
- };
-
- template<typename T>
- struct has_member_unlock<T,true>
- {
- typedef char true_type;
- struct false_type
- {
- true_type dummy[2];
- };
-
- template<typename U,typename V>
- static true_type has_member(V (U::*)());
- template<typename U>
- static false_type has_member(U);
-
- BOOST_STATIC_CONSTANT(
- bool,value=sizeof(has_member_unlock<T>::has_member(&T::unlock))==sizeof(true_type));
- };
-
- template<typename T,bool=has_member_called_try_lock<T>::value >
- struct has_member_try_lock
- {
- BOOST_STATIC_CONSTANT(bool, value=false);
- };
-
- template<typename T>
- struct has_member_try_lock<T,true>
- {
- typedef char true_type;
- struct false_type
- {
- true_type dummy[2];
- };
-
- template<typename U>
- static true_type has_member(bool (U::*)());
- template<typename U>
- static false_type has_member(U);
-
- BOOST_STATIC_CONSTANT(
- bool,value=sizeof(has_member_try_lock<T>::has_member(&T::try_lock))==sizeof(true_type));
- };
-
- }
-
-
- template<typename T>
- struct is_mutex_type
- {
- BOOST_STATIC_CONSTANT(bool, value = detail::has_member_lock<T>::value &&
- detail::has_member_unlock<T>::value &&
- detail::has_member_try_lock<T>::value);
-
- };
-#else
- template<typename T>
- struct is_mutex_type
- {
- BOOST_STATIC_CONSTANT(bool, value = false);
- };
-#endif
-
- struct defer_lock_t
- {};
- struct try_to_lock_t
- {};
- struct adopt_lock_t
- {};
-
- BOOST_CONSTEXPR_OR_CONST defer_lock_t defer_lock={};
- BOOST_CONSTEXPR_OR_CONST try_to_lock_t try_to_lock={};
- BOOST_CONSTEXPR_OR_CONST adopt_lock_t adopt_lock={};
-
- template<typename Mutex>
- class shared_lock;
-
- template<typename Mutex>
- class upgrade_lock;
-
- template<typename Mutex>
- class unique_lock;
-
- namespace detail
- {
- template<typename Mutex>
- class try_lock_wrapper;
- }
-
-#ifdef BOOST_THREAD_NO_AUTO_DETECT_MUTEX_TYPES
- template<typename T>
- struct is_mutex_type<unique_lock<T> >
- {
- BOOST_STATIC_CONSTANT(bool, value = true);
- };
-
- template<typename T>
- struct is_mutex_type<shared_lock<T> >
- {
- BOOST_STATIC_CONSTANT(bool, value = true);
- };
-
- template<typename T>
- struct is_mutex_type<upgrade_lock<T> >
- {
- BOOST_STATIC_CONSTANT(bool, value = true);
- };
-
- template<typename T>
- struct is_mutex_type<detail::try_lock_wrapper<T> >
- {
- BOOST_STATIC_CONSTANT(bool, value = true);
- };
-
- class mutex;
- class timed_mutex;
- class recursive_mutex;
- class recursive_timed_mutex;
- class shared_mutex;
-
- template<>
- struct is_mutex_type<mutex>
- {
- BOOST_STATIC_CONSTANT(bool, value = true);
- };
- template<>
- struct is_mutex_type<timed_mutex>
- {
- BOOST_STATIC_CONSTANT(bool, value = true);
- };
- template<>
- struct is_mutex_type<recursive_mutex>
- {
- BOOST_STATIC_CONSTANT(bool, value = true);
- };
- template<>
- struct is_mutex_type<recursive_timed_mutex>
- {
- BOOST_STATIC_CONSTANT(bool, value = true);
- };
- template<>
- struct is_mutex_type<shared_mutex>
- {
- BOOST_STATIC_CONSTANT(bool, value = true);
- };
-
-#endif
-
- template<typename Mutex>
- class lock_guard
- {
- private:
- Mutex& m;
-
- public:
- typedef Mutex mutex_type;
- BOOST_THREAD_NO_COPYABLE(lock_guard)
-
- explicit lock_guard(Mutex& m_):
- m(m_)
- {
- m.lock();
- }
- lock_guard(Mutex& m_,adopt_lock_t):
- m(m_)
- {}
- ~lock_guard()
- {
- m.unlock();
- }
- };
-
- template<typename Mutex>
- class unique_lock
- {
- private:
- Mutex* m;
- bool is_locked;
-
- private:
- explicit unique_lock(upgrade_lock<Mutex>&);
- unique_lock& operator=(upgrade_lock<Mutex>& other);
- public:
- typedef Mutex mutex_type;
- BOOST_THREAD_MOVABLE_ONLY(unique_lock)
-
-#if 0 // This should not be needed anymore. Use instead BOOST_THREAD_MAKE_RV_REF.
-#if BOOST_WORKAROUND(__SUNPRO_CC, < 0x5100)
- unique_lock(const volatile unique_lock&);
-#endif
-#endif
- unique_lock() BOOST_NOEXCEPT :
- m(0),is_locked(false)
- {}
-
- explicit unique_lock(Mutex& m_):
- m(&m_),is_locked(false)
- {
- lock();
- }
- unique_lock(Mutex& m_,adopt_lock_t):
- m(&m_),is_locked(true)
- {}
- unique_lock(Mutex& m_,defer_lock_t) BOOST_NOEXCEPT:
- m(&m_),is_locked(false)
- {}
- unique_lock(Mutex& m_,try_to_lock_t):
- m(&m_),is_locked(false)
- {
- try_lock();
- }
-#if defined BOOST_THREAD_USES_DATETIME
- template<typename TimeDuration>
- unique_lock(Mutex& m_,TimeDuration const& target_time):
- m(&m_),is_locked(false)
- {
- timed_lock(target_time);
- }
- unique_lock(Mutex& m_,system_time const& target_time):
- m(&m_),is_locked(false)
- {
- timed_lock(target_time);
- }
-#endif
-#ifdef BOOST_THREAD_USES_CHRONO
- template <class Clock, class Duration>
- unique_lock(Mutex& mtx, const chrono::time_point<Clock, Duration>& t)
- : m(&mtx), is_locked(mtx.try_lock_until(t))
- {
- }
- template <class Rep, class Period>
- unique_lock(Mutex& mtx, const chrono::duration<Rep, Period>& d)
- : m(&mtx), is_locked(mtx.try_lock_for(d))
- {
- }
-#endif
-
- unique_lock(BOOST_THREAD_RV_REF(unique_lock) other) BOOST_NOEXCEPT:
- m(BOOST_THREAD_RV(other).m),is_locked(BOOST_THREAD_RV(other).is_locked)
- {
- BOOST_THREAD_RV(other).is_locked=false;
- BOOST_THREAD_RV(other).m=0;
- }
- BOOST_THREAD_EXPLICIT_LOCK_CONVERSION unique_lock(BOOST_THREAD_RV_REF_BEG upgrade_lock<Mutex> BOOST_THREAD_RV_REF_END other);
-
-#ifndef BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
- unique_lock& operator=(BOOST_THREAD_RV_REF_BEG upgrade_lock<Mutex> BOOST_THREAD_RV_REF_END other) BOOST_NOEXCEPT
- {
- unique_lock temp(::boost::move(other));
- swap(temp);
- return *this;
- }
-#endif
-
- unique_lock& operator=(BOOST_THREAD_RV_REF(unique_lock) other) BOOST_NOEXCEPT
- {
- unique_lock temp(::boost::move(other));
- swap(temp);
- return *this;
- }
-#if 0 // This should not be needed anymore. Use instead BOOST_THREAD_MAKE_RV_REF.
-#if BOOST_WORKAROUND(__SUNPRO_CC, < 0x5100)
- unique_lock& operator=(unique_lock<Mutex> other)
- {
- swap(other);
- return *this;
- }
-#endif // BOOST_WORKAROUND
-#endif
-
- // Conversion from upgrade locking
- unique_lock(BOOST_THREAD_RV_REF_BEG upgrade_lock<mutex_type> BOOST_THREAD_RV_REF_END ul, try_to_lock_t)
- : m(0),is_locked(false)
- {
- if (BOOST_THREAD_RV(ul).owns_lock()) {
- if (BOOST_THREAD_RV(ul).mutex()->try_unlock_upgrade_and_lock())
- {
- m = BOOST_THREAD_RV(ul).release();
- is_locked = true;
- }
- }
- else
- {
- m = BOOST_THREAD_RV(ul).release();
- }
- }
-
-#ifdef BOOST_THREAD_USES_CHRONO
- template <class Clock, class Duration>
- unique_lock(BOOST_THREAD_RV_REF_BEG upgrade_lock<mutex_type> BOOST_THREAD_RV_REF_END ul,
- const chrono::time_point<Clock, Duration>& abs_time)
- : m(0),is_locked(false)
- {
- if (BOOST_THREAD_RV(ul).owns_lock()) {
- if (BOOST_THREAD_RV(ul).mutex()->try_unlock_upgrade_and_lock_until(abs_time))
- {
- m = BOOST_THREAD_RV(ul).release();
- is_locked = true;
- }
- }
- else
- {
- m = BOOST_THREAD_RV(ul).release();
- }
- }
-
- template <class Rep, class Period>
- unique_lock(BOOST_THREAD_RV_REF_BEG upgrade_lock<mutex_type> BOOST_THREAD_RV_REF_END ul,
- const chrono::duration<Rep, Period>& rel_time)
- : m(0),is_locked(false)
- {
- if (BOOST_THREAD_RV(ul).owns_lock()) {
- if (BOOST_THREAD_RV(ul).mutex()->try_unlock_upgrade_and_lock_for(rel_time))
- {
- m = BOOST_THREAD_RV(ul).release();
- is_locked = true;
- }
- }
- else
- {
- m = BOOST_THREAD_RV(ul).release();
- }
- }
-#endif
-
-#ifdef BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS
- // Conversion from shared locking
- unique_lock(BOOST_THREAD_RV_REF_BEG shared_lock<mutex_type> BOOST_THREAD_RV_REF_END sl, try_to_lock_t)
- : m(0),is_locked(false)
- {
- if (BOOST_THREAD_RV(sl).owns_lock()) {
- if (BOOST_THREAD_RV(sl).mutex()->try_unlock_shared_and_lock())
- {
- m = BOOST_THREAD_RV(sl).release();
- is_locked = true;
- }
- }
- else
- {
- m = BOOST_THREAD_RV(sl).release();
- }
- }
-
-#ifdef BOOST_THREAD_USES_CHRONO
- template <class Clock, class Duration>
- unique_lock(BOOST_THREAD_RV_REF_BEG shared_lock<mutex_type> BOOST_THREAD_RV_REF_END sl,
- const chrono::time_point<Clock, Duration>& abs_time)
- : m(0),is_locked(false)
- {
- if (BOOST_THREAD_RV(sl).owns_lock()) {
- if (BOOST_THREAD_RV(sl).mutex()->try_unlock_shared_and_lock_until(abs_time))
- {
- m = BOOST_THREAD_RV(sl).release();
- is_locked = true;
- }
- }
- else
- {
- m = BOOST_THREAD_RV(sl).release();
- }
- }
-
- template <class Rep, class Period>
- unique_lock(BOOST_THREAD_RV_REF_BEG shared_lock<mutex_type> BOOST_THREAD_RV_REF_END sl,
- const chrono::duration<Rep, Period>& rel_time)
- : m(0),is_locked(false)
- {
- if (BOOST_THREAD_RV(sl).owns_lock()) {
- if (BOOST_THREAD_RV(sl).mutex()->try_unlock_shared_and_lock_for(rel_time))
- {
- m = BOOST_THREAD_RV(sl).release();
- is_locked = true;
- }
- }
- else
- {
- m = BOOST_THREAD_RV(sl).release();
- }
- }
-#endif // BOOST_THREAD_USES_CHRONO
-#endif // BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS
-
-
- void swap(unique_lock& other) BOOST_NOEXCEPT
- {
- std::swap(m,other.m);
- std::swap(is_locked,other.is_locked);
- }
-
- ~unique_lock()
- {
- if(owns_lock())
- {
- m->unlock();
- }
- }
- void lock()
- {
- if(m==0)
- {
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost unique_lock has no mutex"));
- }
- if(owns_lock())
- {
- boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost unique_lock owns already the mutex"));
- }
- m->lock();
- is_locked=true;
- }
- bool try_lock()
- {
- if(m==0)
- {
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost unique_lock has no mutex"));
- }
- if(owns_lock())
- {
- boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost unique_lock owns already the mutex"));
- }
- is_locked=m->try_lock();
- return is_locked;
- }
-#if defined BOOST_THREAD_USES_DATETIME
- template<typename TimeDuration>
- bool timed_lock(TimeDuration const& relative_time)
- {
- if(m==0)
- {
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost unique_lock has no mutex"));
- }
- if(owns_lock())
- {
- boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost unique_lock owns already the mutex"));
- }
- is_locked=m->timed_lock(relative_time);
- return is_locked;
- }
-
- bool timed_lock(::boost::system_time const& absolute_time)
- {
- if(m==0)
- {
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost unique_lock has no mutex"));
- }
- if(owns_lock())
- {
- boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost unique_lock owns already the mutex"));
- }
- is_locked=m->timed_lock(absolute_time);
- return is_locked;
- }
- bool timed_lock(::boost::xtime const& absolute_time)
- {
- if(m==0)
- {
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost unique_lock has no mutex"));
- }
- if(owns_lock())
- {
- boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost unique_lock owns already the mutex"));
- }
- is_locked=m->timed_lock(absolute_time);
- return is_locked;
- }
-#endif
-#ifdef BOOST_THREAD_USES_CHRONO
-
- template <class Rep, class Period>
- bool try_lock_for(const chrono::duration<Rep, Period>& rel_time)
- {
- if(m==0)
- {
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost unique_lock has no mutex"));
- }
- if(owns_lock())
- {
- boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost unique_lock owns already the mutex"));
- }
- is_locked=m->try_lock_for(rel_time);
- return is_locked;
- }
- template <class Clock, class Duration>
- bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time)
- {
- if(m==0)
- {
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost unique_lock has no mutex"));
- }
- if(owns_lock())
- {
- boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost unique_lock owns already the mutex"));
- }
- is_locked=m->try_lock_until(abs_time);
- return is_locked;
- }
-#endif
-
- void unlock()
- {
- if(m==0)
- {
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost unique_lock has no mutex"));
- }
- if(!owns_lock())
- {
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost unique_lock doesn't own the mutex"));
- }
- m->unlock();
- is_locked=false;
- }
-
-#if defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS)
- typedef void (unique_lock::*bool_type)();
- operator bool_type() const BOOST_NOEXCEPT
- {
- return is_locked?&unique_lock::lock:0;
- }
- bool operator!() const BOOST_NOEXCEPT
- {
- return !owns_lock();
- }
-#else
- explicit operator bool() const BOOST_NOEXCEPT
- {
- return owns_lock();
- }
-#endif
- bool owns_lock() const BOOST_NOEXCEPT
- {
- return is_locked;
- }
-
- Mutex* mutex() const BOOST_NOEXCEPT
- {
- return m;
- }
-
- Mutex* release() BOOST_NOEXCEPT
- {
- Mutex* const res=m;
- m=0;
- is_locked=false;
- return res;
- }
-
- friend class shared_lock<Mutex>;
- friend class upgrade_lock<Mutex>;
- };
-
- template<typename Mutex>
- void swap(unique_lock<Mutex>& lhs,unique_lock<Mutex>& rhs) BOOST_NOEXCEPT
- {
- lhs.swap(rhs);
- }
-
- BOOST_THREAD_DCL_MOVABLE_BEG(Mutex) unique_lock<Mutex> BOOST_THREAD_DCL_MOVABLE_END
-
- template<typename Mutex>
- class shared_lock
- {
- protected:
- Mutex* m;
- bool is_locked;
-
- public:
- typedef Mutex mutex_type;
- BOOST_THREAD_MOVABLE_ONLY(shared_lock)
-
- shared_lock() BOOST_NOEXCEPT:
- m(0),is_locked(false)
- {}
-
- explicit shared_lock(Mutex& m_):
- m(&m_),is_locked(false)
- {
- lock();
- }
- shared_lock(Mutex& m_,adopt_lock_t):
- m(&m_),is_locked(true)
- {}
- shared_lock(Mutex& m_,defer_lock_t) BOOST_NOEXCEPT:
- m(&m_),is_locked(false)
- {}
- shared_lock(Mutex& m_,try_to_lock_t):
- m(&m_),is_locked(false)
- {
- try_lock();
- }
-#if defined BOOST_THREAD_USES_DATETIME
- shared_lock(Mutex& m_,system_time const& target_time):
- m(&m_),is_locked(false)
- {
- timed_lock(target_time);
- }
-#endif
-#ifdef BOOST_THREAD_USES_CHRONO
- template <class Clock, class Duration>
- shared_lock(Mutex& mtx, const chrono::time_point<Clock, Duration>& t)
- : m(&mtx), is_locked(mtx.try_lock_shared_until(t))
- {
- }
- template <class Rep, class Period>
- shared_lock(Mutex& mtx, const chrono::duration<Rep, Period>& d)
- : m(&mtx), is_locked(mtx.try_lock_shared_for(d))
- {
- }
-#endif
-
- shared_lock(BOOST_THREAD_RV_REF_BEG shared_lock<Mutex> BOOST_THREAD_RV_REF_END other) BOOST_NOEXCEPT:
- m(BOOST_THREAD_RV(other).m),is_locked(BOOST_THREAD_RV(other).is_locked)
- {
- BOOST_THREAD_RV(other).is_locked=false;
- BOOST_THREAD_RV(other).m=0;
- }
-
- BOOST_THREAD_EXPLICIT_LOCK_CONVERSION shared_lock(BOOST_THREAD_RV_REF_BEG unique_lock<Mutex> BOOST_THREAD_RV_REF_END other):
- m(BOOST_THREAD_RV(other).m),is_locked(BOOST_THREAD_RV(other).is_locked)
- {
- if(is_locked)
- {
- m->unlock_and_lock_shared();
- }
- BOOST_THREAD_RV(other).is_locked=false;
- BOOST_THREAD_RV(other).m=0;
- }
-
- BOOST_THREAD_EXPLICIT_LOCK_CONVERSION shared_lock(BOOST_THREAD_RV_REF_BEG upgrade_lock<Mutex> BOOST_THREAD_RV_REF_END other):
- m(BOOST_THREAD_RV(other).m),is_locked(BOOST_THREAD_RV(other).is_locked)
- {
- if(is_locked)
- {
- m->unlock_upgrade_and_lock_shared();
- }
- BOOST_THREAD_RV(other).is_locked=false;
- BOOST_THREAD_RV(other).m=0;
- }
-
-
- shared_lock& operator=(BOOST_THREAD_RV_REF_BEG shared_lock<Mutex> BOOST_THREAD_RV_REF_END other) BOOST_NOEXCEPT
- {
- shared_lock temp(::boost::move(other));
- swap(temp);
- return *this;
- }
-#ifndef BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
- shared_lock& operator=(BOOST_THREAD_RV_REF_BEG unique_lock<Mutex> BOOST_THREAD_RV_REF_END other)
- {
- shared_lock temp(::boost::move(other));
- swap(temp);
- return *this;
- }
-
- shared_lock& operator=(BOOST_THREAD_RV_REF_BEG upgrade_lock<Mutex> BOOST_THREAD_RV_REF_END other)
- {
- shared_lock temp(::boost::move(other));
- swap(temp);
- return *this;
- }
-#endif
-
- void swap(shared_lock& other) BOOST_NOEXCEPT
- {
- std::swap(m,other.m);
- std::swap(is_locked,other.is_locked);
- }
-
- Mutex* mutex() const BOOST_NOEXCEPT
- {
- return m;
- }
-
- Mutex* release() BOOST_NOEXCEPT
- {
- Mutex* const res=m;
- m=0;
- is_locked=false;
- return res;
- }
-
- ~shared_lock()
- {
- if(owns_lock())
- {
- m->unlock_shared();
- }
- }
- void lock()
- {
- if(m==0)
- {
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex"));
- }
- if(owns_lock())
- {
- boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost shared_lock owns already the mutex"));
- }
- m->lock_shared();
- is_locked=true;
- }
- bool try_lock()
- {
- if(m==0)
- {
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex"));
- }
- if(owns_lock())
- {
- boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost shared_lock owns already the mutex"));
- }
- is_locked=m->try_lock_shared();
- return is_locked;
- }
-#if defined BOOST_THREAD_USES_DATETIME
- bool timed_lock(boost::system_time const& target_time)
- {
- if(m==0)
- {
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex"));
- }
- if(owns_lock())
- {
- boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost shared_lock owns already the mutex"));
- }
- is_locked=m->timed_lock_shared(target_time);
- return is_locked;
- }
- template<typename Duration>
- bool timed_lock(Duration const& target_time)
- {
- if(m==0)
- {
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex"));
- }
- if(owns_lock())
- {
- boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost shared_lock owns already the mutex"));
- }
- is_locked=m->timed_lock_shared(target_time);
- return is_locked;
- }
-#endif
-#ifdef BOOST_THREAD_USES_CHRONO
- template <class Rep, class Period>
- bool try_lock_for(const chrono::duration<Rep, Period>& rel_time)
- {
- if(m==0)
- {
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex"));
- }
- if(owns_lock())
- {
- boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost shared_lock owns already the mutex"));
- }
- is_locked=m->try_lock_shared_for(rel_time);
- return is_locked;
- }
- template <class Clock, class Duration>
- bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time)
- {
- if(m==0)
- {
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex"));
- }
- if(owns_lock())
- {
- boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost shared_lock owns already the mutex"));
- }
- is_locked=m->try_lock_shared_until(abs_time);
- return is_locked;
- }
-#endif
- void unlock()
- {
- if(m==0)
- {
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex"));
- }
- if(!owns_lock())
- {
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock doesn't own the mutex"));
- }
- m->unlock_shared();
- is_locked=false;
- }
-
-#if defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS)
- typedef void (shared_lock<Mutex>::*bool_type)();
- operator bool_type() const BOOST_NOEXCEPT
- {
- return is_locked?&shared_lock::lock:0;
- }
- bool operator!() const BOOST_NOEXCEPT
- {
- return !owns_lock();
- }
-#else
- explicit operator bool() const BOOST_NOEXCEPT
- {
- return owns_lock();
- }
-#endif
- bool owns_lock() const BOOST_NOEXCEPT
- {
- return is_locked;
- }
-
- };
-
- BOOST_THREAD_DCL_MOVABLE_BEG(Mutex) shared_lock<Mutex> BOOST_THREAD_DCL_MOVABLE_END
-
- template<typename Mutex>
- void swap(shared_lock<Mutex>& lhs,shared_lock<Mutex>& rhs) BOOST_NOEXCEPT
- {
- lhs.swap(rhs);
- }
-
- template<typename Mutex>
- class upgrade_lock
- {
- protected:
- Mutex* m;
- bool is_locked;
-
- public:
- typedef Mutex mutex_type;
- BOOST_THREAD_MOVABLE_ONLY(upgrade_lock)
-
- upgrade_lock() BOOST_NOEXCEPT:
- m(0),is_locked(false)
- {}
-
- explicit upgrade_lock(Mutex& m_):
- m(&m_),is_locked(false)
- {
- lock();
- }
- upgrade_lock(Mutex& m_,adopt_lock_t):
- m(&m_),is_locked(true)
- {}
- upgrade_lock(Mutex& m_,defer_lock_t) BOOST_NOEXCEPT:
- m(&m_),is_locked(false)
- {}
- upgrade_lock(Mutex& m_,try_to_lock_t):
- m(&m_),is_locked(false)
- {
- try_lock();
- }
-
-#ifdef BOOST_THREAD_USES_CHRONO
- template <class Clock, class Duration>
- upgrade_lock(Mutex& mtx, const chrono::time_point<Clock, Duration>& t)
- : m(&mtx), is_locked(mtx.try_lock_upgrade_until(t))
- {
- }
- template <class Rep, class Period>
- upgrade_lock(Mutex& mtx, const chrono::duration<Rep, Period>& d)
- : m(&mtx), is_locked(mtx.try_lock_upgrade_for(d))
- {
- }
-#endif
-
- upgrade_lock(BOOST_THREAD_RV_REF_BEG upgrade_lock<Mutex> BOOST_THREAD_RV_REF_END other) BOOST_NOEXCEPT:
- m(BOOST_THREAD_RV(other).m),is_locked(BOOST_THREAD_RV(other).is_locked)
- {
- BOOST_THREAD_RV(other).is_locked=false;
- BOOST_THREAD_RV(other).m=0;
- }
-
- BOOST_THREAD_EXPLICIT_LOCK_CONVERSION upgrade_lock(BOOST_THREAD_RV_REF_BEG unique_lock<Mutex> BOOST_THREAD_RV_REF_END other):
- m(BOOST_THREAD_RV(other).m),is_locked(BOOST_THREAD_RV(other).is_locked)
- {
- if(is_locked)
- {
- m->unlock_and_lock_upgrade();
- }
- BOOST_THREAD_RV(other).is_locked=false;
- BOOST_THREAD_RV(other).m=0;
- }
-
- upgrade_lock& operator=(BOOST_THREAD_RV_REF_BEG upgrade_lock<Mutex> BOOST_THREAD_RV_REF_END other) BOOST_NOEXCEPT
- {
- upgrade_lock temp(::boost::move(other));
- swap(temp);
- return *this;
- }
-
-#ifndef BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
- upgrade_lock& operator=(BOOST_THREAD_RV_REF_BEG unique_lock<Mutex> BOOST_THREAD_RV_REF_END other)
- {
- upgrade_lock temp(::boost::move(other));
- swap(temp);
- return *this;
- }
-#endif
-
-#ifdef BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS
- // Conversion from shared locking
- upgrade_lock(BOOST_THREAD_RV_REF_BEG shared_lock<mutex_type> BOOST_THREAD_RV_REF_END sl, try_to_lock_t)
- : m(0),is_locked(false)
- {
- if (BOOST_THREAD_RV(sl).owns_lock()) {
- if (BOOST_THREAD_RV(sl).mutex()->try_unlock_shared_and_lock_upgrade())
- {
- m = BOOST_THREAD_RV(sl).release();
- is_locked = true;
- }
- }
- else
- {
- m = BOOST_THREAD_RV(sl).release();
- }
- }
-
-#ifdef BOOST_THREAD_USES_CHRONO
- template <class Clock, class Duration>
- upgrade_lock(BOOST_THREAD_RV_REF_BEG shared_lock<mutex_type> BOOST_THREAD_RV_REF_END sl,
- const chrono::time_point<Clock, Duration>& abs_time)
- : m(0),is_locked(false)
- {
- if (BOOST_THREAD_RV(sl).owns_lock()) {
- if (BOOST_THREAD_RV(sl).mutex()->try_unlock_shared_and_lock_upgrade_until(abs_time))
- {
- m = BOOST_THREAD_RV(sl).release();
- is_locked = true;
- }
- }
- else
- {
- m = BOOST_THREAD_RV(sl).release();
- }
- }
-
- template <class Rep, class Period>
- upgrade_lock(BOOST_THREAD_RV_REF_BEG shared_lock<mutex_type> BOOST_THREAD_RV_REF_END sl,
- const chrono::duration<Rep, Period>& rel_time)
- : m(0),is_locked(false)
- {
- if (BOOST_THREAD_RV(sl).owns_lock()) {
- if (BOOST_THREAD_RV(sl).mutex()->try_unlock_shared_and_lock_upgrade_for(rel_time))
- {
- m = BOOST_THREAD_RV(sl).release();
- is_locked = true;
- }
- }
- else
- {
- m = BOOST_THREAD_RV(sl).release();
- }
- }
-#endif // BOOST_THREAD_USES_CHRONO
-#endif // BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS
-
- void swap(upgrade_lock& other) BOOST_NOEXCEPT
- {
- std::swap(m,other.m);
- std::swap(is_locked,other.is_locked);
- }
- Mutex* mutex() const BOOST_NOEXCEPT
- {
- return m;
- }
-
- Mutex* release() BOOST_NOEXCEPT
- {
- Mutex* const res=m;
- m=0;
- is_locked=false;
- return res;
- }
- ~upgrade_lock()
- {
- if(owns_lock())
- {
- m->unlock_upgrade();
- }
- }
- void lock()
- {
- if(m==0)
- {
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex"));
- }
- if(owns_lock())
- {
- boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost upgrade_lock owns already the mutex"));
- }
- m->lock_upgrade();
- is_locked=true;
- }
- bool try_lock()
- {
- if(m==0)
- {
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex"));
- }
- if(owns_lock())
- {
- boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost upgrade_lock owns already the mutex"));
- }
- is_locked=m->try_lock_upgrade();
- return is_locked;
- }
- void unlock()
- {
- if(m==0)
- {
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex"));
- }
- if(!owns_lock())
- {
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost upgrade_lock doesn't own the mutex"));
- }
- m->unlock_upgrade();
- is_locked=false;
- }
-#ifdef BOOST_THREAD_USES_CHRONO
- template <class Rep, class Period>
- bool try_lock_for(const chrono::duration<Rep, Period>& rel_time)
- {
- if(m==0)
- {
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex"));
- }
- if(owns_lock())
- {
- boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost shared_lock owns already the mutex"));
- }
- is_locked=m->try_lock_upgrade_for(rel_time);
- return is_locked;
- }
- template <class Clock, class Duration>
- bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time)
- {
- if(m==0)
- {
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex"));
- }
- if(owns_lock())
- {
- boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost shared_lock owns already the mutex"));
- }
- is_locked=m->try_lock_upgrade_until(abs_time);
- return is_locked;
- }
-#endif
-#if defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS)
- typedef void (upgrade_lock::*bool_type)();
- operator bool_type() const BOOST_NOEXCEPT
- {
- return is_locked?&upgrade_lock::lock:0;
- }
- bool operator!() const BOOST_NOEXCEPT
- {
- return !owns_lock();
- }
-#else
- explicit operator bool() const BOOST_NOEXCEPT
- {
- return owns_lock();
- }
-#endif
- bool owns_lock() const BOOST_NOEXCEPT
- {
- return is_locked;
- }
- friend class shared_lock<Mutex>;
- friend class unique_lock<Mutex>;
- };
-
- template<typename Mutex>
- void swap(upgrade_lock<Mutex>& lhs,upgrade_lock<Mutex>& rhs) BOOST_NOEXCEPT
- {
- lhs.swap(rhs);
- }
-
- BOOST_THREAD_DCL_MOVABLE_BEG(Mutex) upgrade_lock<Mutex> BOOST_THREAD_DCL_MOVABLE_END
-
- template<typename Mutex>
- unique_lock<Mutex>::unique_lock(BOOST_THREAD_RV_REF_BEG upgrade_lock<Mutex> BOOST_THREAD_RV_REF_END other):
- m(BOOST_THREAD_RV(other).m),is_locked(BOOST_THREAD_RV(other).is_locked)
- {
- if(is_locked)
- {
- m->unlock_upgrade_and_lock();
- }
- BOOST_THREAD_RV(other).release();
- }
-
- template <class Mutex>
- class upgrade_to_unique_lock
- {
- private:
- upgrade_lock<Mutex>* source;
- unique_lock<Mutex> exclusive;
-
- public:
- typedef Mutex mutex_type;
- BOOST_THREAD_MOVABLE_ONLY(upgrade_to_unique_lock)
-
- explicit upgrade_to_unique_lock(upgrade_lock<Mutex>& m_):
- source(&m_),exclusive(::boost::move(*source))
- {}
- ~upgrade_to_unique_lock()
- {
- if(source)
- {
- *source=BOOST_THREAD_MAKE_RV_REF(upgrade_lock<Mutex>(::boost::move(exclusive)));
- }
- }
-
- upgrade_to_unique_lock(BOOST_THREAD_RV_REF_BEG upgrade_to_unique_lock<Mutex> BOOST_THREAD_RV_REF_END other) BOOST_NOEXCEPT:
- source(BOOST_THREAD_RV(other).source),exclusive(::boost::move(BOOST_THREAD_RV(other).exclusive))
- {
- BOOST_THREAD_RV(other).source=0;
- }
-
- upgrade_to_unique_lock& operator=(BOOST_THREAD_RV_REF_BEG upgrade_to_unique_lock<Mutex> BOOST_THREAD_RV_REF_END other) BOOST_NOEXCEPT
- {
- upgrade_to_unique_lock temp(other);
- swap(temp);
- return *this;
- }
-
- void swap(upgrade_to_unique_lock& other) BOOST_NOEXCEPT
- {
- std::swap(source,other.source);
- exclusive.swap(other.exclusive);
- }
-
-#if defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS)
- typedef void (upgrade_to_unique_lock::*bool_type)(upgrade_to_unique_lock&);
- operator bool_type() const BOOST_NOEXCEPT
- {
- return exclusive.owns_lock()?&upgrade_to_unique_lock::swap:0;
- }
- bool operator!() const BOOST_NOEXCEPT
- {
- return !owns_lock();
- }
-#else
- explicit operator bool() const BOOST_NOEXCEPT
- {
- return owns_lock();
- }
-#endif
-
- bool owns_lock() const BOOST_NOEXCEPT
- {
- return exclusive.owns_lock();
- }
- };
-
- BOOST_THREAD_DCL_MOVABLE_BEG(Mutex) upgrade_to_unique_lock<Mutex> BOOST_THREAD_DCL_MOVABLE_END
-
- namespace detail
- {
- template<typename Mutex>
- class try_lock_wrapper:
- private unique_lock<Mutex>
- {
- typedef unique_lock<Mutex> base;
- public:
- BOOST_THREAD_MOVABLE_ONLY(try_lock_wrapper)
-
- try_lock_wrapper()
- {}
-
- explicit try_lock_wrapper(Mutex& m):
- base(m,try_to_lock)
- {}
-
- try_lock_wrapper(Mutex& m_,adopt_lock_t):
- base(m_,adopt_lock)
- {}
- try_lock_wrapper(Mutex& m_,defer_lock_t):
- base(m_,defer_lock)
- {}
- try_lock_wrapper(Mutex& m_,try_to_lock_t):
- base(m_,try_to_lock)
- {}
-#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
- try_lock_wrapper(BOOST_THREAD_RV_REF(try_lock_wrapper) other):
- base(::boost::move(other))
- {}
-
-#elif defined BOOST_THREAD_USES_MOVE
- try_lock_wrapper(BOOST_THREAD_RV_REF(try_lock_wrapper) other):
- base(::boost::move(static_cast<base&>(other)))
- {}
-
-#else
- try_lock_wrapper(BOOST_THREAD_RV_REF(try_lock_wrapper) other):
- base(BOOST_THREAD_RV_REF(base)(*other))
- {}
-#endif
- try_lock_wrapper& operator=(BOOST_THREAD_RV_REF_BEG try_lock_wrapper<Mutex> BOOST_THREAD_RV_REF_END other)
- {
- try_lock_wrapper temp(other);
- swap(temp);
- return *this;
- }
- void swap(try_lock_wrapper& other)
- {
- base::swap(other);
- }
- void lock()
- {
- base::lock();
- }
- bool try_lock()
- {
- return base::try_lock();
- }
- void unlock()
- {
- base::unlock();
- }
- bool owns_lock() const
- {
- return base::owns_lock();
- }
- Mutex* mutex() const
- {
- return base::mutex();
- }
- Mutex* release()
- {
- return base::release();
- }
-
-#if defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS)
- typedef typename base::bool_type bool_type;
- operator bool_type() const
- {
- return base::operator bool_type();
- }
- bool operator!() const
- {
- return !this->owns_lock();
- }
-#else
- explicit operator bool() const
- {
- return owns_lock();
- }
-#endif
- };
-
- template<typename Mutex>
- void swap(try_lock_wrapper<Mutex>& lhs,try_lock_wrapper<Mutex>& rhs)
- {
- lhs.swap(rhs);
- }
-
- template<typename MutexType1,typename MutexType2>
- unsigned try_lock_internal(MutexType1& m1,MutexType2& m2)
- {
- boost::unique_lock<MutexType1> l1(m1,boost::try_to_lock);
- if(!l1)
- {
- return 1;
- }
- if(!m2.try_lock())
- {
- return 2;
- }
- l1.release();
- return 0;
- }
-
- template<typename MutexType1,typename MutexType2,typename MutexType3>
- unsigned try_lock_internal(MutexType1& m1,MutexType2& m2,MutexType3& m3)
- {
- boost::unique_lock<MutexType1> l1(m1,boost::try_to_lock);
- if(!l1)
- {
- return 1;
- }
- if(unsigned const failed_lock=try_lock_internal(m2,m3))
- {
- return failed_lock+1;
- }
- l1.release();
- return 0;
- }
-
-
- template<typename MutexType1,typename MutexType2,typename MutexType3,
- typename MutexType4>
- unsigned try_lock_internal(MutexType1& m1,MutexType2& m2,MutexType3& m3,
- MutexType4& m4)
- {
- boost::unique_lock<MutexType1> l1(m1,boost::try_to_lock);
- if(!l1)
- {
- return 1;
- }
- if(unsigned const failed_lock=try_lock_internal(m2,m3,m4))
- {
- return failed_lock+1;
- }
- l1.release();
- return 0;
- }
-
- template<typename MutexType1,typename MutexType2,typename MutexType3,
- typename MutexType4,typename MutexType5>
- unsigned try_lock_internal(MutexType1& m1,MutexType2& m2,MutexType3& m3,
- MutexType4& m4,MutexType5& m5)
- {
- boost::unique_lock<MutexType1> l1(m1,boost::try_to_lock);
- if(!l1)
- {
- return 1;
- }
- if(unsigned const failed_lock=try_lock_internal(m2,m3,m4,m5))
- {
- return failed_lock+1;
- }
- l1.release();
- return 0;
- }
-
-
- template<typename MutexType1,typename MutexType2>
- unsigned lock_helper(MutexType1& m1,MutexType2& m2)
- {
- boost::unique_lock<MutexType1> l1(m1);
- if(!m2.try_lock())
- {
- return 1;
- }
- l1.release();
- return 0;
- }
-
- template<typename MutexType1,typename MutexType2,typename MutexType3>
- unsigned lock_helper(MutexType1& m1,MutexType2& m2,MutexType3& m3)
- {
- boost::unique_lock<MutexType1> l1(m1);
- if(unsigned const failed_lock=try_lock_internal(m2,m3))
- {
- return failed_lock;
- }
- l1.release();
- return 0;
- }
-
- template<typename MutexType1,typename MutexType2,typename MutexType3,
- typename MutexType4>
- unsigned lock_helper(MutexType1& m1,MutexType2& m2,MutexType3& m3,
- MutexType4& m4)
- {
- boost::unique_lock<MutexType1> l1(m1);
- if(unsigned const failed_lock=try_lock_internal(m2,m3,m4))
- {
- return failed_lock;
- }
- l1.release();
- return 0;
- }
-
- template<typename MutexType1,typename MutexType2,typename MutexType3,
- typename MutexType4,typename MutexType5>
- unsigned lock_helper(MutexType1& m1,MutexType2& m2,MutexType3& m3,
- MutexType4& m4,MutexType5& m5)
- {
- boost::unique_lock<MutexType1> l1(m1);
- if(unsigned const failed_lock=try_lock_internal(m2,m3,m4,m5))
- {
- return failed_lock;
- }
- l1.release();
- return 0;
- }
- }
-
- namespace detail
- {
- template<bool x>
- struct is_mutex_type_wrapper
- {};
-
- template<typename MutexType1,typename MutexType2>
- void lock_impl(MutexType1& m1,MutexType2& m2,is_mutex_type_wrapper<true>)
- {
- unsigned const lock_count=2;
- unsigned lock_first=0;
- for(;;)
- {
- switch(lock_first)
- {
- case 0:
- lock_first=detail::lock_helper(m1,m2);
- if(!lock_first)
- return;
- break;
- case 1:
- lock_first=detail::lock_helper(m2,m1);
- if(!lock_first)
- return;
- lock_first=(lock_first+1)%lock_count;
- break;
- }
- }
- }
-
- template<typename Iterator>
- void lock_impl(Iterator begin,Iterator end,is_mutex_type_wrapper<false>);
- }
-
-
- template<typename MutexType1,typename MutexType2>
- void lock(MutexType1& m1,MutexType2& m2)
- {
- detail::lock_impl(m1,m2,detail::is_mutex_type_wrapper<is_mutex_type<MutexType1>::value>());
- }
-
- template<typename MutexType1,typename MutexType2>
- void lock(const MutexType1& m1,MutexType2& m2)
- {
- detail::lock_impl(m1,m2,detail::is_mutex_type_wrapper<is_mutex_type<MutexType1>::value>());
- }
-
- template<typename MutexType1,typename MutexType2>
- void lock(MutexType1& m1,const MutexType2& m2)
- {
- detail::lock_impl(m1,m2,detail::is_mutex_type_wrapper<is_mutex_type<MutexType1>::value>());
- }
-
- template<typename MutexType1,typename MutexType2>
- void lock(const MutexType1& m1,const MutexType2& m2)
- {
- detail::lock_impl(m1,m2,detail::is_mutex_type_wrapper<is_mutex_type<MutexType1>::value>());
- }
-
- template<typename MutexType1,typename MutexType2,typename MutexType3>
- void lock(MutexType1& m1,MutexType2& m2,MutexType3& m3)
- {
- unsigned const lock_count=3;
- unsigned lock_first=0;
- for(;;)
- {
- switch(lock_first)
- {
- case 0:
- lock_first=detail::lock_helper(m1,m2,m3);
- if(!lock_first)
- return;
- break;
- case 1:
- lock_first=detail::lock_helper(m2,m3,m1);
- if(!lock_first)
- return;
- lock_first=(lock_first+1)%lock_count;
- break;
- case 2:
- lock_first=detail::lock_helper(m3,m1,m2);
- if(!lock_first)
- return;
- lock_first=(lock_first+2)%lock_count;
- break;
- }
- }
- }
-
- template<typename MutexType1,typename MutexType2,typename MutexType3,
- typename MutexType4>
- void lock(MutexType1& m1,MutexType2& m2,MutexType3& m3,
- MutexType4& m4)
- {
- unsigned const lock_count=4;
- unsigned lock_first=0;
- for(;;)
- {
- switch(lock_first)
- {
- case 0:
- lock_first=detail::lock_helper(m1,m2,m3,m4);
- if(!lock_first)
- return;
- break;
- case 1:
- lock_first=detail::lock_helper(m2,m3,m4,m1);
- if(!lock_first)
- return;
- lock_first=(lock_first+1)%lock_count;
- break;
- case 2:
- lock_first=detail::lock_helper(m3,m4,m1,m2);
- if(!lock_first)
- return;
- lock_first=(lock_first+2)%lock_count;
- break;
- case 3:
- lock_first=detail::lock_helper(m4,m1,m2,m3);
- if(!lock_first)
- return;
- lock_first=(lock_first+3)%lock_count;
- break;
- }
- }
- }
-
- template<typename MutexType1,typename MutexType2,typename MutexType3,
- typename MutexType4,typename MutexType5>
- void lock(MutexType1& m1,MutexType2& m2,MutexType3& m3,
- MutexType4& m4,MutexType5& m5)
- {
- unsigned const lock_count=5;
- unsigned lock_first=0;
- for(;;)
- {
- switch(lock_first)
- {
- case 0:
- lock_first=detail::lock_helper(m1,m2,m3,m4,m5);
- if(!lock_first)
- return;
- break;
- case 1:
- lock_first=detail::lock_helper(m2,m3,m4,m5,m1);
- if(!lock_first)
- return;
- lock_first=(lock_first+1)%lock_count;
- break;
- case 2:
- lock_first=detail::lock_helper(m3,m4,m5,m1,m2);
- if(!lock_first)
- return;
- lock_first=(lock_first+2)%lock_count;
- break;
- case 3:
- lock_first=detail::lock_helper(m4,m5,m1,m2,m3);
- if(!lock_first)
- return;
- lock_first=(lock_first+3)%lock_count;
- break;
- case 4:
- lock_first=detail::lock_helper(m5,m1,m2,m3,m4);
- if(!lock_first)
- return;
- lock_first=(lock_first+4)%lock_count;
- break;
- }
- }
- }
-
- namespace detail
- {
- template<typename Mutex,bool x=is_mutex_type<Mutex>::value>
- struct try_lock_impl_return
- {
- typedef int type;
- };
-
- template<typename Iterator>
- struct try_lock_impl_return<Iterator,false>
- {
- typedef Iterator type;
- };
-
- template<typename MutexType1,typename MutexType2>
- int try_lock_impl(MutexType1& m1,MutexType2& m2,is_mutex_type_wrapper<true>)
- {
- return ((int)detail::try_lock_internal(m1,m2))-1;
- }
-
- template<typename Iterator>
- Iterator try_lock_impl(Iterator begin,Iterator end,is_mutex_type_wrapper<false>);
- }
-
- template<typename MutexType1,typename MutexType2>
- typename detail::try_lock_impl_return<MutexType1>::type try_lock(MutexType1& m1,MutexType2& m2)
- {
- return detail::try_lock_impl(m1,m2,detail::is_mutex_type_wrapper<is_mutex_type<MutexType1>::value>());
- }
-
- template<typename MutexType1,typename MutexType2>
- typename detail::try_lock_impl_return<MutexType1>::type try_lock(const MutexType1& m1,MutexType2& m2)
- {
- return detail::try_lock_impl(m1,m2,detail::is_mutex_type_wrapper<is_mutex_type<MutexType1>::value>());
- }
-
- template<typename MutexType1,typename MutexType2>
- typename detail::try_lock_impl_return<MutexType1>::type try_lock(MutexType1& m1,const MutexType2& m2)
- {
- return detail::try_lock_impl(m1,m2,detail::is_mutex_type_wrapper<is_mutex_type<MutexType1>::value>());
- }
-
- template<typename MutexType1,typename MutexType2>
- typename detail::try_lock_impl_return<MutexType1>::type try_lock(const MutexType1& m1,const MutexType2& m2)
- {
- return detail::try_lock_impl(m1,m2,detail::is_mutex_type_wrapper<is_mutex_type<MutexType1>::value>());
- }
-
- template<typename MutexType1,typename MutexType2,typename MutexType3>
- int try_lock(MutexType1& m1,MutexType2& m2,MutexType3& m3)
- {
- return ((int)detail::try_lock_internal(m1,m2,m3))-1;
- }
-
- template<typename MutexType1,typename MutexType2,typename MutexType3,typename MutexType4>
- int try_lock(MutexType1& m1,MutexType2& m2,MutexType3& m3,MutexType4& m4)
- {
- return ((int)detail::try_lock_internal(m1,m2,m3,m4))-1;
- }
-
- template<typename MutexType1,typename MutexType2,typename MutexType3,typename MutexType4,typename MutexType5>
- int try_lock(MutexType1& m1,MutexType2& m2,MutexType3& m3,MutexType4& m4,MutexType5& m5)
- {
- return ((int)detail::try_lock_internal(m1,m2,m3,m4,m5))-1;
- }
-
-
- namespace detail
- {
- template<typename Iterator>
- struct range_lock_guard
- {
- Iterator begin;
- Iterator end;
-
- range_lock_guard(Iterator begin_,Iterator end_):
- begin(begin_),end(end_)
- {
- boost::lock(begin,end);
- }
-
- void release()
- {
- begin=end;
- }
-
- ~range_lock_guard()
- {
- for(;begin!=end;++begin)
- {
- begin->unlock();
- }
- }
- };
-
- template<typename Iterator>
- Iterator try_lock_impl(Iterator begin,Iterator end,is_mutex_type_wrapper<false>)
-
- {
- if(begin==end)
- {
- return end;
- }
- typedef typename std::iterator_traits<Iterator>::value_type lock_type;
- unique_lock<lock_type> guard(*begin,try_to_lock);
-
- if(!guard.owns_lock())
- {
- return begin;
- }
- Iterator const failed=boost::try_lock(++begin,end);
- if(failed==end)
- {
- guard.release();
- }
-
- return failed;
- }
- }
-
-
- namespace detail
- {
- template<typename Iterator>
- void lock_impl(Iterator begin,Iterator end,is_mutex_type_wrapper<false>)
- {
- typedef typename std::iterator_traits<Iterator>::value_type lock_type;
-
- if(begin==end)
- {
- return;
- }
- bool start_with_begin=true;
- Iterator second=begin;
- ++second;
- Iterator next=second;
-
- for(;;)
- {
- unique_lock<lock_type> begin_lock(*begin,defer_lock);
- if(start_with_begin)
- {
- begin_lock.lock();
- Iterator const failed_lock=boost::try_lock(next,end);
- if(failed_lock==end)
- {
- begin_lock.release();
- return;
- }
- start_with_begin=false;
- next=failed_lock;
- }
- else
- {
- detail::range_lock_guard<Iterator> guard(next,end);
- if(begin_lock.try_lock())
- {
- Iterator const failed_lock=boost::try_lock(second,next);
- if(failed_lock==next)
- {
- begin_lock.release();
- guard.release();
- return;
- }
- start_with_begin=false;
- next=failed_lock;
- }
- else
- {
- start_with_begin=true;
- next=second;
- }
- }
- }
- }
-
- }
 
-}
-#include <boost/config/abi_suffix.hpp>
+#include <boost/thread/lock_algorithms.hpp>
+#include <boost/thread/lock_types.hpp>
+#include <boost/thread/lock_guard.hpp>
+#include <boost/thread/lockable_traits.hpp>
+#include <boost/thread/lock_options.hpp>
 
 #endif

Modified: trunk/boost/thread/pthread/condition_variable.hpp
==============================================================================
--- trunk/boost/thread/pthread/condition_variable.hpp (original)
+++ trunk/boost/thread/pthread/condition_variable.hpp 2012-10-29 15:57:01 EDT (Mon, 29 Oct 2012)
@@ -20,10 +20,12 @@
 
 namespace boost
 {
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
     namespace this_thread
     {
         void BOOST_THREAD_DECL interruption_point();
     }
+#endif
 
     namespace thread_cv_detail
     {
@@ -56,13 +58,17 @@
         int res=0;
         {
             thread_cv_detail::lock_on_exit<unique_lock<mutex> > guard;
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
             detail::interruption_checker check_for_interruption(&internal_mutex,&cond);
+#endif
             guard.activate(m);
             do {
               res = pthread_cond_wait(&cond,&internal_mutex);
             } while (res == EINTR);
         }
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
         this_thread::interruption_point();
+#endif
         if(res)
         {
             boost::throw_exception(condition_error(res, "boost:: condition_variable constructor failed in pthread_cond_wait"));
@@ -79,11 +85,15 @@
         thread_cv_detail::lock_on_exit<unique_lock<mutex> > guard;
         int cond_res;
         {
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
             detail::interruption_checker check_for_interruption(&internal_mutex,&cond);
+#endif
             guard.activate(m);
             cond_res=pthread_cond_timedwait(&cond,&internal_mutex,&timeout);
         }
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
         this_thread::interruption_point();
+#endif
         if(cond_res==ETIMEDOUT)
         {
             return false;
@@ -140,11 +150,15 @@
             int res=0;
             {
                 thread_cv_detail::lock_on_exit<lock_type> guard;
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
                 detail::interruption_checker check_for_interruption(&internal_mutex,&cond);
+#endif
                 guard.activate(m);
                 res=pthread_cond_wait(&cond,&internal_mutex);
             }
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
             this_thread::interruption_point();
+#endif
             if(res)
             {
                 boost::throw_exception(condition_error(res, "condition_variable_any failed in pthread_cond_wait"));
@@ -310,11 +324,15 @@
           int res=0;
           {
               thread_cv_detail::lock_on_exit<lock_type> guard;
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
               detail::interruption_checker check_for_interruption(&internal_mutex,&cond);
+#endif
               guard.activate(m);
               res=pthread_cond_timedwait(&cond,&internal_mutex,&timeout);
           }
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
           this_thread::interruption_point();
+#endif
           if(res==ETIMEDOUT)
           {
               return false;

Modified: trunk/boost/thread/pthread/condition_variable_fwd.hpp
==============================================================================
--- trunk/boost/thread/pthread/condition_variable_fwd.hpp (original)
+++ trunk/boost/thread/pthread/condition_variable_fwd.hpp 2012-10-29 15:57:01 EDT (Mon, 29 Oct 2012)
@@ -11,7 +11,7 @@
 #include <pthread.h>
 #include <boost/thread/cv_status.hpp>
 #include <boost/thread/mutex.hpp>
-#include <boost/thread/locks.hpp>
+#include <boost/thread/lock_types.hpp>
 #include <boost/thread/thread_time.hpp>
 #include <boost/thread/xtime.hpp>
 #ifdef BOOST_THREAD_USES_CHRONO

Modified: trunk/boost/thread/pthread/mutex.hpp
==============================================================================
--- trunk/boost/thread/pthread/mutex.hpp (original)
+++ trunk/boost/thread/pthread/mutex.hpp 2012-10-29 15:57:01 EDT (Mon, 29 Oct 2012)
@@ -9,7 +9,9 @@
 #include <pthread.h>
 #include <boost/throw_exception.hpp>
 #include <boost/thread/exceptions.hpp>
-#include <boost/thread/locks.hpp>
+#if defined BOOST_THREAD_PROVIDES_NESTED_LOCKS
+#include <boost/thread/lock_types.hpp>
+#endif
 #include <boost/thread/thread_time.hpp>
 #include <boost/thread/xtime.hpp>
 #include <boost/assert.hpp>
@@ -71,12 +73,15 @@
 
         void unlock()
         {
- int ret;
+ int res;
             do
             {
- ret = pthread_mutex_unlock(&m);
- } while (ret == EINTR);
- BOOST_VERIFY(!ret);
+ res = pthread_mutex_unlock(&m);
+ } while (res == EINTR);
+ if (res)
+ {
+ boost::throw_exception(lock_error(res,"boost: mutex unlock failed in pthread_mutex_lock"));
+ }
         }
 
         bool try_lock()
@@ -86,12 +91,8 @@
             {
                 res = pthread_mutex_trylock(&m);
             } while (res == EINTR);
- if(res && (res!=EBUSY))
+ if (res==EBUSY)
             {
- // The following throw_exception has been replaced by an assertion and just return false,
- // as this is an internal error and the user can do nothing with the exception.
- //boost::throw_exception(lock_error(res,"boost: mutex try_lock failed in pthread_mutex_trylock"));
- BOOST_ASSERT_MSG(false ,"boost: mutex try_lock failed in pthread_mutex_trylock");
                 return false;
             }
 
@@ -105,8 +106,10 @@
             return &m;
         }
 
+#if defined BOOST_THREAD_PROVIDES_NESTED_LOCKS
         typedef unique_lock<mutex> scoped_lock;
         typedef detail::try_lock_wrapper<mutex> scoped_try_lock;
+#endif
     };
 
     typedef mutex try_mutex;
@@ -160,19 +163,43 @@
 #ifdef BOOST_PTHREAD_HAS_TIMEDLOCK
         void lock()
         {
- BOOST_VERIFY(!pthread_mutex_lock(&m));
+ int res;
+ do
+ {
+ res = pthread_mutex_lock(&m);
+ } while (res == EINTR);
+ if (res)
+ {
+ boost::throw_exception(lock_error(res,"boost: mutex lock failed in pthread_mutex_lock"));
+ }
         }
 
         void unlock()
         {
- BOOST_VERIFY(!pthread_mutex_unlock(&m));
+ int res;
+ do
+ {
+ res = pthread_mutex_unlock(&m);
+ } while (res == EINTR);
+ if (res)
+ {
+ boost::throw_exception(lock_error(res,"boost: mutex unlock failed in pthread_mutex_lock"));
+ }
         }
 
         bool try_lock()
         {
- int const res=pthread_mutex_trylock(&m);
- BOOST_ASSERT(!res || res==EBUSY);
- return !res;
+ int res;
+ do
+ {
+ res = pthread_mutex_trylock(&m);
+ } while (res == EINTR);
+ if (res==EBUSY)
+ {
+ return false;
+ }
+
+ return !res;
         }
 
 
@@ -280,9 +307,11 @@
             return &m;
         }
 
+#if defined BOOST_THREAD_PROVIDES_NESTED_LOCKS
         typedef unique_lock<timed_mutex> scoped_timed_lock;
         typedef detail::try_lock_wrapper<timed_mutex> scoped_try_lock;
         typedef scoped_timed_lock scoped_lock;
+#endif
     };
 
 }

Modified: trunk/boost/thread/pthread/recursive_mutex.hpp
==============================================================================
--- trunk/boost/thread/pthread/recursive_mutex.hpp (original)
+++ trunk/boost/thread/pthread/recursive_mutex.hpp 2012-10-29 15:57:01 EDT (Mon, 29 Oct 2012)
@@ -9,7 +9,9 @@
 #include <pthread.h>
 #include <boost/throw_exception.hpp>
 #include <boost/thread/exceptions.hpp>
-#include <boost/thread/locks.hpp>
+#if defined BOOST_THREAD_PROVIDES_NESTED_LOCKS
+#include <boost/thread/lock_types.hpp>
+#endif
 #include <boost/thread/thread_time.hpp>
 #include <boost/assert.hpp>
 #ifndef _WIN32
@@ -167,8 +169,10 @@
 
 #endif
 
+#if defined BOOST_THREAD_PROVIDES_NESTED_LOCKS
         typedef unique_lock<recursive_mutex> scoped_lock;
         typedef detail::try_lock_wrapper<recursive_mutex> scoped_try_lock;
+#endif
     };
 
     typedef recursive_mutex recursive_try_mutex;
@@ -383,9 +387,11 @@
             return &m;
         }
 
+#if defined BOOST_THREAD_PROVIDES_NESTED_LOCKS
         typedef unique_lock<recursive_timed_mutex> scoped_timed_lock;
         typedef detail::try_lock_wrapper<recursive_timed_mutex> scoped_try_lock;
         typedef scoped_timed_lock scoped_lock;
+#endif
     };
 
 }

Modified: trunk/boost/thread/pthread/shared_mutex.hpp
==============================================================================
--- trunk/boost/thread/pthread/shared_mutex.hpp (original)
+++ trunk/boost/thread/pthread/shared_mutex.hpp 2012-10-29 15:57:01 EDT (Mon, 29 Oct 2012)
@@ -12,7 +12,9 @@
 #include <boost/static_assert.hpp>
 #include <boost/thread/mutex.hpp>
 #include <boost/thread/condition_variable.hpp>
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
 #include <boost/thread/detail/thread_interruption.hpp>
+#endif
 #ifdef BOOST_THREAD_USES_CHRONO
 #include <boost/chrono/system_clocks.hpp>
 #include <boost/chrono/ceil.hpp>
@@ -63,8 +65,10 @@
 
         void lock_shared()
         {
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
             boost::this_thread::disable_interruption do_not_disturb;
- boost::mutex::scoped_lock lk(state_change);
+#endif
+ boost::unique_lock<boost::mutex> lk(state_change);
 
             while(state.exclusive || state.exclusive_waiting_blocked)
             {
@@ -75,7 +79,7 @@
 
         bool try_lock_shared()
         {
- boost::mutex::scoped_lock lk(state_change);
+ boost::unique_lock<boost::mutex> lk(state_change);
 
             if(state.exclusive || state.exclusive_waiting_blocked)
             {
@@ -91,8 +95,10 @@
 #if defined BOOST_THREAD_USES_DATETIME
         bool timed_lock_shared(system_time const& timeout)
         {
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
             boost::this_thread::disable_interruption do_not_disturb;
- boost::mutex::scoped_lock lk(state_change);
+#endif
+ boost::unique_lock<boost::mutex> lk(state_change);
 
             while(state.exclusive || state.exclusive_waiting_blocked)
             {
@@ -120,8 +126,10 @@
         template <class Clock, class Duration>
         bool try_lock_shared_until(const chrono::time_point<Clock, Duration>& abs_time)
         {
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
           boost::this_thread::disable_interruption do_not_disturb;
- boost::mutex::scoped_lock lk(state_change);
+#endif
+ boost::unique_lock<boost::mutex> lk(state_change);
 
           while(state.exclusive || state.exclusive_waiting_blocked)
           {
@@ -136,7 +144,7 @@
 #endif
         void unlock_shared()
         {
- boost::mutex::scoped_lock lk(state_change);
+ boost::unique_lock<boost::mutex> lk(state_change);
             bool const last_reader=!--state.shared_count;
 
             if(last_reader)
@@ -157,8 +165,10 @@
 
         void lock()
         {
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
             boost::this_thread::disable_interruption do_not_disturb;
- boost::mutex::scoped_lock lk(state_change);
+#endif
+ boost::unique_lock<boost::mutex> lk(state_change);
 
             while(state.shared_count || state.exclusive)
             {
@@ -171,8 +181,10 @@
 #if defined BOOST_THREAD_USES_DATETIME
         bool timed_lock(system_time const& timeout)
         {
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
             boost::this_thread::disable_interruption do_not_disturb;
- boost::mutex::scoped_lock lk(state_change);
+#endif
+ boost::unique_lock<boost::mutex> lk(state_change);
 
             while(state.shared_count || state.exclusive)
             {
@@ -207,8 +219,10 @@
         template <class Clock, class Duration>
         bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time)
         {
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
           boost::this_thread::disable_interruption do_not_disturb;
- boost::mutex::scoped_lock lk(state_change);
+#endif
+ boost::unique_lock<boost::mutex> lk(state_change);
 
           while(state.shared_count || state.exclusive)
           {
@@ -231,7 +245,7 @@
 
         bool try_lock()
         {
- boost::mutex::scoped_lock lk(state_change);
+ boost::unique_lock<boost::mutex> lk(state_change);
 
             if(state.shared_count || state.exclusive)
             {
@@ -247,7 +261,7 @@
 
         void unlock()
         {
- boost::mutex::scoped_lock lk(state_change);
+ boost::unique_lock<boost::mutex> lk(state_change);
             state.exclusive=false;
             state.exclusive_waiting_blocked=false;
             release_waiters();
@@ -255,8 +269,10 @@
 
         void lock_upgrade()
         {
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
             boost::this_thread::disable_interruption do_not_disturb;
- boost::mutex::scoped_lock lk(state_change);
+#endif
+ boost::unique_lock<boost::mutex> lk(state_change);
             while(state.exclusive || state.exclusive_waiting_blocked || state.upgrade)
             {
                 shared_cond.wait(lk);
@@ -268,8 +284,10 @@
 #if defined BOOST_THREAD_USES_DATETIME
         bool timed_lock_upgrade(system_time const& timeout)
         {
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
             boost::this_thread::disable_interruption do_not_disturb;
- boost::mutex::scoped_lock lk(state_change);
+#endif
+ boost::unique_lock<boost::mutex> lk(state_change);
             while(state.exclusive || state.exclusive_waiting_blocked || state.upgrade)
             {
                 if(!shared_cond.timed_wait(lk,timeout))
@@ -301,8 +319,10 @@
         template <class Clock, class Duration>
         bool try_lock_upgrade_until(const chrono::time_point<Clock, Duration>& abs_time)
         {
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
           boost::this_thread::disable_interruption do_not_disturb;
- boost::mutex::scoped_lock lk(state_change);
+#endif
+ boost::unique_lock<boost::mutex> lk(state_change);
           while(state.exclusive || state.exclusive_waiting_blocked || state.upgrade)
           {
               if(cv_status::timeout == shared_cond.wait_until(lk,abs_time))
@@ -321,7 +341,7 @@
 #endif
         bool try_lock_upgrade()
         {
- boost::mutex::scoped_lock lk(state_change);
+ boost::unique_lock<boost::mutex> lk(state_change);
             if(state.exclusive || state.exclusive_waiting_blocked || state.upgrade)
             {
                 return false;
@@ -336,7 +356,7 @@
 
         void unlock_upgrade()
         {
- boost::mutex::scoped_lock lk(state_change);
+ boost::unique_lock<boost::mutex> lk(state_change);
             state.upgrade=false;
             bool const last_reader=!--state.shared_count;
 
@@ -352,8 +372,10 @@
         // Upgrade <-> Exclusive
         void unlock_upgrade_and_lock()
         {
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
             boost::this_thread::disable_interruption do_not_disturb;
- boost::mutex::scoped_lock lk(state_change);
+#endif
+ boost::unique_lock<boost::mutex> lk(state_change);
             --state.shared_count;
             while(state.shared_count)
             {
@@ -365,7 +387,7 @@
 
         void unlock_and_lock_upgrade()
         {
- boost::mutex::scoped_lock lk(state_change);
+ boost::unique_lock<boost::mutex> lk(state_change);
             state.exclusive=false;
             state.upgrade=true;
             ++state.shared_count;
@@ -375,7 +397,7 @@
 
         bool try_unlock_upgrade_and_lock()
         {
- boost::mutex::scoped_lock lk(state_change);
+ boost::unique_lock<boost::mutex> lk(state_change);
           if( !state.exclusive
               && !state.exclusive_waiting_blocked
               && state.upgrade
@@ -402,8 +424,10 @@
         try_unlock_upgrade_and_lock_until(
                           const chrono::time_point<Clock, Duration>& abs_time)
         {
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
           boost::this_thread::disable_interruption do_not_disturb;
- boost::mutex::scoped_lock lk(state_change);
+#endif
+ boost::unique_lock<boost::mutex> lk(state_change);
           if (state.shared_count != 1)
           {
               for (;;)
@@ -426,7 +450,7 @@
         // Shared <-> Exclusive
         void unlock_and_lock_shared()
         {
- boost::mutex::scoped_lock lk(state_change);
+ boost::unique_lock<boost::mutex> lk(state_change);
             state.exclusive=false;
             ++state.shared_count;
             state.exclusive_waiting_blocked=false;
@@ -436,7 +460,7 @@
 #ifdef BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS
         bool try_unlock_shared_and_lock()
         {
- boost::mutex::scoped_lock lk(state_change);
+ boost::unique_lock<boost::mutex> lk(state_change);
           if( !state.exclusive
               && !state.exclusive_waiting_blocked
               && !state.upgrade
@@ -462,8 +486,10 @@
             try_unlock_shared_and_lock_until(
                           const chrono::time_point<Clock, Duration>& abs_time)
         {
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
           boost::this_thread::disable_interruption do_not_disturb;
- boost::mutex::scoped_lock lk(state_change);
+#endif
+ boost::unique_lock<boost::mutex> lk(state_change);
           if (state.shared_count != 1)
           {
               for (;;)
@@ -487,7 +513,7 @@
         // Shared <-> Upgrade
         void unlock_upgrade_and_lock_shared()
         {
- boost::mutex::scoped_lock lk(state_change);
+ boost::unique_lock<boost::mutex> lk(state_change);
             state.upgrade=false;
             state.exclusive_waiting_blocked=false;
             release_waiters();
@@ -496,7 +522,7 @@
 #ifdef BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS
         bool try_unlock_shared_and_lock_upgrade()
         {
- boost::mutex::scoped_lock lk(state_change);
+ boost::unique_lock<boost::mutex> lk(state_change);
           if( !state.exclusive
               && !state.exclusive_waiting_blocked
               && !state.upgrade
@@ -521,8 +547,10 @@
             try_unlock_shared_and_lock_upgrade_until(
                           const chrono::time_point<Clock, Duration>& abs_time)
         {
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
           boost::this_thread::disable_interruption do_not_disturb;
- boost::mutex::scoped_lock lk(state_change);
+#endif
+ boost::unique_lock<boost::mutex> lk(state_change);
           if( state.exclusive
               || state.exclusive_waiting_blocked
               || state.upgrade

Modified: trunk/boost/thread/pthread/thread_data.hpp
==============================================================================
--- trunk/boost/thread/pthread/thread_data.hpp (original)
+++ trunk/boost/thread/pthread/thread_data.hpp 2012-10-29 15:57:01 EDT (Mon, 29 Oct 2012)
@@ -8,7 +8,8 @@
 
 #include <boost/thread/detail/config.hpp>
 #include <boost/thread/exceptions.hpp>
-#include <boost/thread/locks.hpp>
+#include <boost/thread/lock_guard.hpp>
+#include <boost/thread/lock_types.hpp>
 #include <boost/thread/mutex.hpp>
 #include <boost/thread/pthread/condition_variable_fwd.hpp>
 
@@ -107,8 +108,10 @@
             bool joined;
             boost::detail::thread_exit_callback_node* thread_exit_callbacks;
             std::map<void const*,boost::detail::tss_data_node> tss_data;
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
             bool interrupt_enabled;
             bool interrupt_requested;
+#endif
             pthread_mutex_t* cond_mutex;
             pthread_cond_t* current_cond;
             typedef std::vector<std::pair<condition_variable*, mutex*>
@@ -119,8 +122,10 @@
             thread_data_base():
                 done(false),join_started(false),joined(false),
                 thread_exit_callbacks(0),
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
                 interrupt_enabled(true),
                 interrupt_requested(false),
+#endif
                 current_cond(0),
                 notify()
             {}
@@ -137,6 +142,7 @@
 
         BOOST_THREAD_DECL thread_data_base* get_current_thread_data();
 
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
         class interruption_checker
         {
             thread_data_base* const thread_info;
@@ -189,6 +195,7 @@
             }
         };
     }
+#endif
 
     namespace this_thread
     {

Modified: trunk/boost/thread/reverse_lock.hpp
==============================================================================
--- trunk/boost/thread/reverse_lock.hpp (original)
+++ trunk/boost/thread/reverse_lock.hpp 2012-10-29 15:57:01 EDT (Mon, 29 Oct 2012)
@@ -6,7 +6,9 @@
 #ifndef BOOST_THREAD_REVERSE_LOCK_HPP
 #define BOOST_THREAD_REVERSE_LOCK_HPP
 #include <boost/thread/detail/config.hpp>
-#include <boost/thread/locks.hpp>
+#include <boost/thread/detail/move.hpp>
+#include <boost/thread/lockable_traits.hpp>
+#include <boost/thread/lock_options.hpp>
 #include <boost/thread/detail/delete.hpp>
 
 namespace boost
@@ -15,7 +17,6 @@
     template<typename Lock>
     class reverse_lock
     {
-
     public:
         typedef typename Lock::mutex_type mutex_type;
         BOOST_THREAD_NO_COPYABLE(reverse_lock)

Modified: trunk/boost/thread/shared_lock_guard.hpp
==============================================================================
--- trunk/boost/thread/shared_lock_guard.hpp (original)
+++ trunk/boost/thread/shared_lock_guard.hpp 2012-10-29 15:57:01 EDT (Mon, 29 Oct 2012)
@@ -6,7 +6,8 @@
 #ifndef BOOST_THREAD_SHARED_LOCK_GUARD_HPP
 #define BOOST_THREAD_SHARED_LOCK_GUARD_HPP
 #include <boost/thread/detail/config.hpp>
-#include <boost/thread/locks.hpp>
+//#include <boost/thread/locks.hpp>
+#include <boost/thread/lock_options.hpp>
 #include <boost/thread/detail/delete.hpp>
 
 namespace boost

Modified: trunk/boost/thread/thread.hpp
==============================================================================
--- trunk/boost/thread/thread.hpp (original)
+++ trunk/boost/thread/thread.hpp 2012-10-29 15:57:01 EDT (Mon, 29 Oct 2012)
@@ -20,7 +20,9 @@
 #endif
 
 #include <boost/thread/detail/thread.hpp>
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
 #include <boost/thread/detail/thread_interruption.hpp>
+#endif
 #include <boost/thread/detail/thread_group.hpp>
 #include <boost/thread/v2/thread.hpp>
 

Modified: trunk/boost/thread/v2/thread.hpp
==============================================================================
--- trunk/boost/thread/v2/thread.hpp (original)
+++ trunk/boost/thread/v2/thread.hpp 2012-10-29 15:57:01 EDT (Mon, 29 Oct 2012)
@@ -11,7 +11,7 @@
 #include <boost/chrono/system_clocks.hpp>
 #endif
 #include <boost/thread/condition_variable.hpp>
-#include <boost/thread/locks.hpp>
+#include <boost/thread/lock_types.hpp>
 
 namespace boost
 {

Modified: trunk/boost/thread/win32/condition_variable.hpp
==============================================================================
--- trunk/boost/thread/win32/condition_variable.hpp (original)
+++ trunk/boost/thread/win32/condition_variable.hpp 2012-10-29 15:57:01 EDT (Mon, 29 Oct 2012)
@@ -14,6 +14,8 @@
 #include <boost/thread/xtime.hpp>
 #include <boost/thread/mutex.hpp>
 #include <boost/thread/thread_time.hpp>
+#include <boost/thread/lock_guard.hpp>
+#include <boost/thread/lock_types.hpp>
 
 #include <boost/assert.hpp>
 #include <boost/intrusive_ptr.hpp>

Modified: trunk/boost/thread/win32/mutex.hpp
==============================================================================
--- trunk/boost/thread/win32/mutex.hpp (original)
+++ trunk/boost/thread/win32/mutex.hpp 2012-10-29 15:57:01 EDT (Mon, 29 Oct 2012)
@@ -8,7 +8,10 @@
 
 #include <boost/thread/win32/basic_timed_mutex.hpp>
 #include <boost/thread/exceptions.hpp>
-#include <boost/thread/locks.hpp>
+#if defined BOOST_THREAD_PROVIDES_NESTED_LOCKS
+#include <boost/thread/lock_types.hpp>
+#endif
+#include <boost/thread/detail/delete.hpp>
 
 #include <boost/config/abi_prefix.hpp>
 
@@ -33,8 +36,10 @@
             destroy();
         }
 
+#if defined BOOST_THREAD_PROVIDES_NESTED_LOCKS
         typedef unique_lock<mutex> scoped_lock;
         typedef detail::try_lock_wrapper<mutex> scoped_try_lock;
+#endif
     };
 
     typedef mutex try_mutex;
@@ -54,9 +59,11 @@
             destroy();
         }
 
+#if defined BOOST_THREAD_PROVIDES_NESTED_LOCKS
         typedef unique_lock<timed_mutex> scoped_timed_lock;
         typedef detail::try_lock_wrapper<timed_mutex> scoped_try_lock;
         typedef scoped_timed_lock scoped_lock;
+#endif
     };
 }
 

Modified: trunk/boost/thread/win32/recursive_mutex.hpp
==============================================================================
--- trunk/boost/thread/win32/recursive_mutex.hpp (original)
+++ trunk/boost/thread/win32/recursive_mutex.hpp 2012-10-29 15:57:01 EDT (Mon, 29 Oct 2012)
@@ -12,7 +12,9 @@
 
 #include <boost/thread/win32/basic_recursive_mutex.hpp>
 #include <boost/thread/exceptions.hpp>
-#include <boost/thread/locks.hpp>
+#if defined BOOST_THREAD_PROVIDES_NESTED_LOCKS
+#include <boost/thread/lock_types.hpp>
+#endif
 
 #include <boost/config/abi_prefix.hpp>
 
@@ -32,8 +34,10 @@
             ::boost::detail::basic_recursive_mutex::destroy();
         }
 
+#if defined BOOST_THREAD_PROVIDES_NESTED_LOCKS
         typedef unique_lock<recursive_mutex> scoped_lock;
         typedef detail::try_lock_wrapper<recursive_mutex> scoped_try_lock;
+#endif
     };
 
     typedef recursive_mutex recursive_try_mutex;
@@ -52,9 +56,11 @@
             ::boost::detail::basic_recursive_timed_mutex::destroy();
         }
 
+#if defined BOOST_THREAD_PROVIDES_NESTED_LOCKS
         typedef unique_lock<recursive_timed_mutex> scoped_timed_lock;
         typedef detail::try_lock_wrapper<recursive_timed_mutex> scoped_try_lock;
         typedef scoped_timed_lock scoped_lock;
+#endif
     };
 }
 

Modified: trunk/boost/thread/win32/thread_data.hpp
==============================================================================
--- trunk/boost/thread/win32/thread_data.hpp (original)
+++ trunk/boost/thread/win32/thread_data.hpp 2012-10-29 15:57:01 EDT (Mon, 29 Oct 2012)
@@ -93,10 +93,14 @@
         {
             long count;
             detail::win32::handle_manager thread_handle;
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
             detail::win32::handle_manager interruption_handle;
+#endif
             boost::detail::thread_exit_callback_node* thread_exit_callbacks;
             std::map<void const*,boost::detail::tss_data_node> tss_data;
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
             bool interruption_enabled;
+#endif
             unsigned id;
             typedef std::vector<std::pair<condition_variable*, mutex*>
             //, hidden_allocator<std::pair<condition_variable*, mutex*> >
@@ -106,9 +110,13 @@
 
             thread_data_base():
                 count(0),thread_handle(detail::win32::invalid_handle_value),
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
                 interruption_handle(create_anonymous_event(detail::win32::manual_reset_event,detail::win32::event_initially_reset)),
+#endif
                 thread_exit_callbacks(0),tss_data(),
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
                 interruption_enabled(true),
+#endif
                 id(0),
                 notify()
             {}
@@ -127,11 +135,12 @@
                 }
             }
 
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
             void interrupt()
             {
                 BOOST_VERIFY(detail::win32::SetEvent(interruption_handle)!=0);
             }
-
+#endif
             typedef detail::win32::handle native_handle_type;
 
             virtual void run()=0;
@@ -240,7 +249,6 @@
         {
             interruptible_wait(detail::win32::invalid_handle_value,abs_time);
         }
-
         template<typename TimeDuration>
         inline BOOST_SYMBOL_VISIBLE void sleep(TimeDuration const& rel_time)
         {

Modified: trunk/libs/thread/example/shared_monitor.cpp
==============================================================================
--- trunk/libs/thread/example/shared_monitor.cpp (original)
+++ trunk/libs/thread/example/shared_monitor.cpp 2012-10-29 15:57:01 EDT (Mon, 29 Oct 2012)
@@ -6,6 +6,7 @@
 #include <iostream>
 #include <boost/thread/mutex.hpp>
 #include <boost/thread/shared_mutex.hpp>
+#include <boost/thread/lock_algorithms.hpp>
 #include <boost/thread/thread.hpp>
 #if defined BOOST_THREAD_DONT_USE_CHRONO
 #include <boost/chrono/chrono_io.hpp>

Modified: trunk/libs/thread/example/shared_mutex.cpp
==============================================================================
--- trunk/libs/thread/example/shared_mutex.cpp (original)
+++ trunk/libs/thread/example/shared_mutex.cpp 2012-10-29 15:57:01 EDT (Mon, 29 Oct 2012)
@@ -10,6 +10,7 @@
 #include <iostream>
 #include <boost/thread/mutex.hpp>
 #include <boost/thread/shared_mutex.hpp>
+#include <boost/thread/lock_algorithms.hpp>
 #include <boost/thread/thread.hpp>
 #include <vector>
 

Modified: trunk/libs/thread/src/pthread/thread.cpp
==============================================================================
--- trunk/libs/thread/src/pthread/thread.cpp (original)
+++ trunk/libs/thread/src/pthread/thread.cpp 2012-10-29 15:57:01 EDT (Mon, 29 Oct 2012)
@@ -149,9 +149,13 @@
                 boost::detail::thread_data_ptr thread_info = static_cast<boost::detail::thread_data_base*>(param)->self;
                 thread_info->self.reset();
                 detail::set_current_thread_data(thread_info.get());
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
                 BOOST_TRY
                 {
+#endif
                     thread_info->run();
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
+
                 }
                 BOOST_CATCH (thread_interrupted const&)
                 {
@@ -163,7 +167,7 @@
 // std::terminate();
 // }
                 BOOST_CATCH_END
-
+#endif
                 detail::tls_destructor(thread_info.get());
                 detail::set_current_thread_data(0);
                 boost::lock_guard<boost::mutex> lock(thread_info->data_mutex);
@@ -178,7 +182,9 @@
         {
             externally_launched_thread()
             {
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
                 interrupt_enabled=false;
+#endif
             }
 
             void run()
@@ -401,7 +407,6 @@
     namespace this_thread
     {
 
-#if ! defined BOOST_THREAD_USES_DATETIME2
 #ifdef __DECXXX
         /// Workaround of DECCXX issue of incorrect template substitution
         template<>
@@ -445,7 +450,6 @@
                 }
             }
         }
-#endif
         void yield() BOOST_NOEXCEPT
         {
 # if defined(BOOST_HAS_SCHED_YIELD)
@@ -477,6 +481,7 @@
 #endif
     }
 
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
     void thread::interrupt()
     {
         detail::thread_data_ptr const local_thread_info=(get_thread_info)();
@@ -505,6 +510,7 @@
             return false;
         }
     }
+#endif
 
     thread::native_handle_type thread::native_handle()
     {
@@ -522,6 +528,7 @@
 
 
 
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
     namespace this_thread
     {
         void interruption_point()
@@ -593,6 +600,7 @@
             }
         }
     }
+#endif
 
     namespace detail
     {

Modified: trunk/libs/thread/src/win32/thread.cpp
==============================================================================
--- trunk/libs/thread/src/win32/thread.cpp (original)
+++ trunk/libs/thread/src/win32/thread.cpp 2012-10-29 15:57:01 EDT (Mon, 29 Oct 2012)
@@ -196,9 +196,12 @@
         {
             detail::thread_data_base* const thread_info(reinterpret_cast<detail::thread_data_base*>(param));
             set_current_thread_data(thread_info);
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
             BOOST_TRY
             {
+#endif
                 thread_info->run();
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
             }
             BOOST_CATCH(thread_interrupted const&)
             {
@@ -210,6 +213,7 @@
 // std::terminate();
 // }
             BOOST_CATCH_END
+#endif
             run_thread_exit_callbacks();
             return 0;
         }
@@ -259,7 +263,9 @@
             externally_launched_thread()
             {
                 ++count;
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
                 interruption_enabled=false;
+#endif
             }
 
             void run()
@@ -372,6 +378,7 @@
         thread_info=0;
     }
 
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
     void thread::interrupt()
     {
         detail::thread_data_ptr local_thread_info=(get_thread_info)();
@@ -393,6 +400,7 @@
         GetSystemInfo(&info);
         return info.dwNumberOfProcessors;
     }
+#endif
 
     thread::native_handle_type thread::native_handle()
     {
@@ -469,19 +477,22 @@
             detail::win32::handle handles[3]={0};
             unsigned handle_count=0;
             unsigned wait_handle_index=~0U;
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
             unsigned interruption_index=~0U;
+#endif
             unsigned timeout_index=~0U;
             if(handle_to_wait_for!=detail::win32::invalid_handle_value)
             {
                 wait_handle_index=handle_count;
                 handles[handle_count++]=handle_to_wait_for;
             }
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
             if(get_current_thread_data() && get_current_thread_data()->interruption_enabled)
             {
                 interruption_index=handle_count;
                 handles[handle_count++]=get_current_thread_data()->interruption_handle;
             }
-
+#endif
             detail::win32::handle_manager timer_handle;
 
 #ifndef UNDER_CE
@@ -533,11 +544,13 @@
                         {
                             return true;
                         }
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
                         else if(notified_index==interruption_index)
                         {
                             detail::win32::ResetEvent(get_current_thread_data()->interruption_handle);
                             throw thread_interrupted();
                         }
+#endif
                         else if(notified_index==timeout_index)
                         {
                             return false;
@@ -560,13 +573,13 @@
         thread::id get_id() BOOST_NOEXCEPT
         {
         #if defined BOOST_THREAD_PROVIDES_BASIC_THREAD_ID
- //return detail::win32::GetCurrentThread();
           return detail::win32::GetCurrentThreadId();
         #else
             return thread::id(get_or_make_current_thread_data());
         #endif
         }
 
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
         void interruption_point()
         {
             if(interruption_enabled() && interruption_requested())
@@ -585,12 +598,14 @@
         {
             return get_current_thread_data() && (detail::win32::WaitForSingleObject(get_current_thread_data()->interruption_handle,0)==0);
         }
+#endif
 
         void yield() BOOST_NOEXCEPT
         {
             detail::win32::Sleep(0);
         }
 
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
         disable_interruption::disable_interruption() BOOST_NOEXCEPT:
             interruption_was_enabled(interruption_enabled())
         {
@@ -624,6 +639,7 @@
             }
         }
     }
+#endif
 
     namespace detail
     {


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