$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r81145 - in trunk: boost/thread boost/thread/detail libs/thread/test
From: vicente.botet_at_[hidden]
Date: 2012-11-02 03:31:22
Author: viboes
Date: 2012-11-02 03:31:19 EDT (Fri, 02 Nov 2012)
New Revision: 81145
URL: http://svn.boost.org/trac/boost/changeset/81145
Log:
Thread: extract invoke and make_tuple_indeces on specific files+change the condition to BOOST_NO_CXX11_DECLTYPE_N3276+ fix a warning when BOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED is not defined
Added:
   trunk/boost/thread/detail/invoke.hpp   (contents, props changed)
   trunk/boost/thread/detail/make_tuple_indices.hpp   (contents, props changed)
Text files modified: 
   trunk/boost/thread/detail/config.hpp |     2                                         
   trunk/boost/thread/detail/thread.hpp |   101 +-------------------------------------- 
   trunk/boost/thread/future.hpp        |    11 +--                                     
   trunk/libs/thread/test/Jamfile.v2    |     2                                         
   4 files changed, 12 insertions(+), 104 deletions(-)
Modified: trunk/boost/thread/detail/config.hpp
==============================================================================
--- trunk/boost/thread/detail/config.hpp	(original)
+++ trunk/boost/thread/detail/config.hpp	2012-11-02 03:31:19 EDT (Fri, 02 Nov 2012)
@@ -181,6 +181,8 @@
 #if ! defined(BOOST_NO_SFINAE_EXPR) && \
     ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \
     ! defined(BOOST_NO_CXX11_DECLTYPE) && \
+    ! defined(BOOST_NO_CXX11_DECLTYPE_N3276) && \
+    ! defined(BOOST_NO_CXX11_AUTO) && \
     ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \
     ! defined(BOOST_NO_CXX11_HDR_TUPLE)
 
Added: trunk/boost/thread/detail/invoke.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/thread/detail/invoke.hpp	2012-11-02 03:31:19 EDT (Fri, 02 Nov 2012)
@@ -0,0 +1,88 @@
+// Copyright (C) 2012 Vicente J. Botet Escriba
+//
+//  Distributed under the Boost Software License, Version 1.0. (See accompanying
+//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+// The invoke code is based on the one from libcxx.
+//===----------------------------------------------------------------------===//
+
+#ifndef BOOST_THREAD_DETAIL_INVOKE_HPP
+#define BOOST_THREAD_DETAIL_INVOKE_HPP
+
+#include <boost/config.hpp>
+#include <boost/static_assert.hpp>
+
+namespace boost
+{
+  namespace detail
+  {
+
+#if ! defined(BOOST_NO_SFINAE_EXPR) && \
+    ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \
+    ! defined(BOOST_NO_CXX11_DECLTYPE) && \
+    ! defined(BOOST_NO_CXX11_DECLTYPE_N3276) && \
+    ! defined(BOOST_NO_CXX11_AUTO) && \
+    ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
+
+    //      // bullets 1 and 2
+
+    template <class Fp, class A0, class ...Args>
+    inline
+    auto
+    invoke(Fp&& f, A0&& a0, Args&& ...args)
+        -> decltype((boost::forward<A0>(a0).*f)(boost::forward<Args>(args)...))
+    {
+        return (boost::forward<A0>(a0).*f)(boost::forward<Args>(args)...);
+    }
+
+    template <class Fp, class A0, class ...Args>
+    inline
+    auto
+    invoke(Fp&& f, A0&& a0, Args&& ...args)
+        -> decltype(((*boost::forward<A0>(a0)).*f)(boost::forward<Args>(args)...))
+    {
+        return ((*boost::forward<A0>(a0)).*f)(boost::forward<Args>(args)...);
+    }
+
+    // bullets 3 and 4
+
+    template <class Fp, class A0>
+    inline
+    auto
+    invoke(Fp&& f, A0&& a0)
+        -> decltype(boost::forward<A0>(a0).*f)
+    {
+        return boost::forward<A0>(a0).*f;
+    }
+
+    template <class Fp, class A0>
+    inline
+    auto
+    invoke(Fp&& f, A0&& a0)
+        -> decltype((*boost::forward<A0>(a0)).*f)
+    {
+        return (*boost::forward<A0>(a0)).*f;
+    }
+
+    // bullet 5
+
+    template <class Fp, class ...Args>
+    inline
+    auto invoke(Fp&& f, Args&& ...args)
+    -> decltype(boost::forward<Fp>(f)(boost::forward<Args>(args)...))
+    {
+      return boost::forward<Fp>(f)(boost::forward<Args>(args)...);
+    }
+
+#endif
+      }
+    }
+
+#endif // header
Added: trunk/boost/thread/detail/make_tuple_indices.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/thread/detail/make_tuple_indices.hpp	2012-11-02 03:31:19 EDT (Fri, 02 Nov 2012)
@@ -0,0 +1,60 @@
+// Copyright (C) 2012 Vicente J. Botet Escriba
+//
+//  Distributed under the Boost Software License, Version 1.0. (See accompanying
+//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+// The make_tuple_indices code is based on the one from libcxx.
+//===----------------------------------------------------------------------===//
+
+#ifndef BOOST_THREAD_DETAIL_MAKE_TUPLE_INDICES_HPP
+#define BOOST_THREAD_DETAIL_MAKE_TUPLE_INDICES_HPP
+
+#include <boost/config.hpp>
+#include <boost/static_assert.hpp>
+
+namespace boost
+{
+  namespace detail
+  {
+
+#if ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \
+    ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
+
+    // make_tuple_indices
+
+    template <std::size_t...> struct tuple_indices
+    {};
+
+    template <std::size_t Sp, class IntTuple, std::size_t Ep>
+    struct make_indices_imp;
+
+    template <std::size_t Sp, std::size_t ...Indices, std::size_t Ep>
+    struct make_indices_imp<Sp, tuple_indices<Indices...>, Ep>
+    {
+      typedef typename make_indices_imp<Sp+1, tuple_indices<Indices..., Sp>, Ep>::type type;
+    };
+
+    template <std::size_t Ep, std::size_t ...Indices>
+    struct make_indices_imp<Ep, tuple_indices<Indices...>, Ep>
+    {
+      typedef tuple_indices<Indices...> type;
+    };
+
+    template <std::size_t Ep, std::size_t Sp = 0>
+    struct make_tuple_indices
+    {
+      BOOST_STATIC_ASSERT_MSG(Sp <= Ep, "make_tuple_indices input error");
+      typedef typename make_indices_imp<Sp, tuple_indices<>, Ep>::type type;
+    };
+#endif
+  }
+}
+
+#endif // header
Modified: trunk/boost/thread/detail/thread.hpp
==============================================================================
--- trunk/boost/thread/detail/thread.hpp	(original)
+++ trunk/boost/thread/detail/thread.hpp	2012-11-02 03:31:19 EDT (Fri, 02 Nov 2012)
@@ -6,15 +6,6 @@
 // (C) Copyright 2007-10 Anthony Williams
 // (C) Copyright 20011-12 Vicente J. Botet Escriba
 
-//===----------------------------------------------------------------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-// 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>
@@ -25,6 +16,8 @@
 #include <boost/thread/mutex.hpp>
 #include <boost/thread/xtime.hpp>
 #include <boost/thread/detail/thread_heap_alloc.hpp>
+#include <boost/thread/detail/make_tuple_indices.hpp>
+#include <boost/thread/detail/invoke.hpp>
 #include <boost/assert.hpp>
 #include <list>
 #include <algorithm>
@@ -62,92 +55,6 @@
 
 #if defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
 
-      // __make_tuple_indices
-
-      template <std::size_t...> struct tuple_indices {};
-
-      template <std::size_t Sp, class IntTuple, std::size_t Ep>
-      struct make_indices_imp;
-
-      template <std::size_t Sp, std::size_t ...Indices, std::size_t Ep>
-      struct make_indices_imp<Sp, tuple_indices<Indices...>, Ep>
-      {
-          typedef typename make_indices_imp<Sp+1, tuple_indices<Indices..., Sp>, Ep>::type type;
-      };
-
-      template <std::size_t Ep, std::size_t ...Indices>
-      struct make_indices_imp<Ep, tuple_indices<Indices...>, Ep>
-      {
-          typedef tuple_indices<Indices...> type;
-      };
-
-      template <std::size_t Ep, std::size_t Sp = 0>
-      struct make_tuple_indices
-      {
-          static_assert(Sp <= Ep, "make_tuple_indices input error");
-          typedef typename make_indices_imp<Sp, tuple_indices<>, Ep>::type type;
-      };
-
-
-//      // bullets 1 and 2
-//
-//      template <class Fp, class A0, class ...Args>
-//      inline
-//      auto
-//      invoke(Fp&& f, A0&& a0, Args&& ...args)
-//          -> decltype((boost::forward<A0>(a0).*f)(boost::forward<Args>(args)...))
-//      {
-//          return (boost::forward<A0>(a0).*f)(boost::forward<Args>(args)...);
-//      }
-//
-//      template <class Fp, class A0, class ...Args>
-//      inline
-//      auto
-//      invoke(Fp&& f, A0&& a0, Args&& ...args)
-//          -> decltype(((*boost::forward<A0>(a0)).*f)(boost::forward<Args>(args)...))
-//      {
-//          return ((*boost::forward<A0>(a0)).*f)(boost::forward<Args>(args)...);
-//      }
-//
-//      // bullets 3 and 4
-//
-//      template <class Fp, class A0>
-//      inline
-//      auto
-//      invoke(Fp&& f, A0&& a0)
-//          -> decltype(boost::forward<A0>(a0).*f)
-//      {
-//          return boost::forward<A0>(a0).*f;
-//      }
-//
-//      template <class Fp, class A0>
-//      inline
-//      auto
-//      invoke(Fp&& f, A0&& a0)
-//          -> decltype((*boost::forward<A0>(a0)).*f)
-//      {
-//          return (*boost::forward<A0>(a0)).*f;
-//      }
-
-      // bullet 5
-
-      template <class Fp, class ...Args>
-      inline
-      auto
-      invoke(Fp&& f, Args&& ...args)
-          -> decltype(boost::forward<Fp>(f)(boost::forward<Args>(args)...))
-      {
-          return boost::forward<Fp>(f)(boost::forward<Args>(args)...);
-      }
-
-//      template <class Tp, class ...Args>
-//      struct invoke_return
-//      {
-//          typedef decltype(invoke(boost::declval<Tp>(), boost::declval<Args>()...)) type;
-//      };
-
-
-
       template<typename F, class ...ArgTypes>
       class thread_data:
           public detail::thread_data_base
@@ -173,8 +80,6 @@
           }
 
       private:
-          //F f;
-          //std::tuple<ArgTypes...> args;
           std::tuple<typename decay<F>::type, typename decay<ArgTypes>::type...> fp;
       };
 #else // defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
@@ -855,6 +760,8 @@
         {
 #ifdef BOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED
             boost::throw_exception(thread_resource_error(system::errc::invalid_argument, "boost thread: thread not joinable"));
+#else
+            return false;
 #endif
         }
     }
Modified: trunk/boost/thread/future.hpp
==============================================================================
--- trunk/boost/thread/future.hpp	(original)
+++ trunk/boost/thread/future.hpp	2012-11-02 03:31:19 EDT (Fri, 02 Nov 2012)
@@ -896,6 +896,7 @@
       /// Common implementation for all the futures independently of the return type
       class base_future
       {
+        //BOOST_THREAD_MOVABLE(base_future)
 
       };
       /// Common implementation for future and shared_future.
@@ -919,12 +920,9 @@
         typedef future_state::state state;
 
         BOOST_THREAD_MOVABLE(basic_future)
-        basic_future()
-        {
-        }
-        ~basic_future()
-        {
-        }
+        basic_future(): future_() {}
+        ~basic_future() {}
+
         basic_future(BOOST_THREAD_RV_REF(basic_future) other) BOOST_NOEXCEPT:
         future_(BOOST_THREAD_RV(other).future_)
         {
@@ -1063,7 +1061,6 @@
 
         BOOST_THREAD_FUTURE& operator=(BOOST_THREAD_RV_REF(BOOST_THREAD_FUTURE) other) BOOST_NOEXCEPT
         {
-
             base_type::operator=(boost::move(static_cast<base_type&>(BOOST_THREAD_RV(other))));
             return *this;
         }
Modified: trunk/libs/thread/test/Jamfile.v2
==============================================================================
--- trunk/libs/thread/test/Jamfile.v2	(original)
+++ trunk/libs/thread/test/Jamfile.v2	2012-11-02 03:31:19 EDT (Fri, 02 Nov 2012)
@@ -23,6 +23,8 @@
     : requirements
         <threading>multi
 
+        <define>BOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED
+
         <warnings>all
         <toolset>gcc:<cxxflags>-Wextra
         <toolset>gcc:<cxxflags>-pedantic