Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r86471 - in trunk/boost/thread: . detail
From: vicente.botet_at_[hidden]
Date: 2013-10-26 19:35:40


Author: viboes
Date: 2013-10-26 19:35:40 EDT (Sat, 26 Oct 2013)
New Revision: 86471
URL: http://svn.boost.org/trac/boost/changeset/86471

Log:
Thread: cleanup replacing some macros by the types imported on csbl namespace comming from std or boost. Cleanup work type ussage.

Text files modified:
   trunk/boost/thread/completion_latch.hpp | 15 ++------
   trunk/boost/thread/detail/async_func.hpp | 10 +----
   trunk/boost/thread/detail/work.hpp | 9 -----
   trunk/boost/thread/executor.hpp | 10 -----
   trunk/boost/thread/future.hpp | 67 +++++++++++++++++----------------------
   trunk/boost/thread/thread_pool.hpp | 44 ++++++++++----------------
   6 files changed, 54 insertions(+), 101 deletions(-)

Modified: trunk/boost/thread/completion_latch.hpp
==============================================================================
--- trunk/boost/thread/completion_latch.hpp Sat Oct 26 19:25:53 2013 (r86470)
+++ trunk/boost/thread/completion_latch.hpp 2013-10-26 19:35:40 EDT (Sat, 26 Oct 2013) (r86471)
@@ -16,12 +16,8 @@
 #include <boost/chrono/duration.hpp>
 #include <boost/chrono/time_point.hpp>
 #include <boost/assert.hpp>
-#ifdef BOOST_NO_CXX11_HDR_FUNCTIONAL
-#include <boost/function.hpp>
-#else
-#include <functional>
-#endif
-//#include <boost/thread/latch.hpp>
+//#include <boost/thread/detail/nullary_function.hpp>
+#include <boost/thread/csbl/functional.hpp>
 
 #include <boost/config/abi_prefix.hpp>
 
@@ -37,11 +33,8 @@
   {
   public:
     /// the implementation defined completion function type
-#ifdef BOOST_NO_CXX11_HDR_FUNCTIONAL
- typedef function<void()> completion_function;
-#else
- typedef std::function<void()> completion_function;
-#endif
+ //typedef detail::nullary_function<void()> completion_function;
+ typedef csbl::function<void()> completion_function;
     /// noop completion function factory
     static completion_function noop()
     {

Modified: trunk/boost/thread/detail/async_func.hpp
==============================================================================
--- trunk/boost/thread/detail/async_func.hpp Sat Oct 26 19:25:53 2013 (r86470)
+++ trunk/boost/thread/detail/async_func.hpp 2013-10-26 19:35:40 EDT (Sat, 26 Oct 2013) (r86471)
@@ -29,13 +29,7 @@
 #include <boost/thread/detail/move.hpp>
 #include <boost/thread/detail/invoke.hpp>
 #include <boost/thread/detail/make_tuple_indices.hpp>
-
-#if ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \
- ! defined(BOOST_NO_CXX11_HDR_TUPLE)
-#include <tuple>
-#else
-#include <boost/tuple/tuple.hpp>
-#endif
+#include <boost/thread/csbl/tuple.hpp>
 
 namespace boost
 {
@@ -48,7 +42,7 @@
     template <class Fp, class ... Args>
     class async_func
     {
- std::tuple<Fp, Args...> f_;
+ csbl::tuple<Fp, Args...> f_;
 
     public:
       BOOST_THREAD_MOVABLE_ONLY( async_func)

Modified: trunk/boost/thread/detail/work.hpp
==============================================================================
--- trunk/boost/thread/detail/work.hpp Sat Oct 26 19:25:53 2013 (r86470)
+++ trunk/boost/thread/detail/work.hpp 2013-10-26 19:35:40 EDT (Sat, 26 Oct 2013) (r86471)
@@ -7,24 +7,15 @@
 #ifndef BOOST_THREAD_DETAIL_WORK_HPP
 #define BOOST_THREAD_DETAIL_WORK_HPP
 
-#define BOOST_THREAD_USES_NULLARY_FUNCTION_AS_WORK
 
-#ifdef BOOST_THREAD_USES_NULLARY_FUNCTION_AS_WORK
 #include <boost/thread/detail/nullary_function.hpp>
-#else
-#include <boost/thread/detail/function_wrapper.hpp>
-#endif
 
 namespace boost
 {
   namespace thread_detail
   {
 
-#ifdef BOOST_THREAD_USES_NULLARY_FUNCTION_AS_WORK
     typedef detail::nullary_function<void()> work;
-#else
- typedef detail::function_wrapper work;
-#endif
   }
 
 } // namespace boost

Modified: trunk/boost/thread/executor.hpp
==============================================================================
--- trunk/boost/thread/executor.hpp Sat Oct 26 19:25:53 2013 (r86470)
+++ trunk/boost/thread/executor.hpp 2013-10-26 19:35:40 EDT (Sat, 26 Oct 2013) (r86471)
@@ -71,14 +71,7 @@
      * \b Throws: \c sync_queue_is_closed if the thread pool is closed.
      * Whatever exception that can be throw while storing the closure.
      */
-#ifndef BOOST_THREAD_USES_NULLARY_FUNCTION_AS_WORK
- template <typename Closure>
- void submit(Closure const& closure)
- {
- work w ((closure));
- submit(boost::move(w));
- }
-#else
+
 #if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
     template <typename Closure>
     void submit(Closure & closure)
@@ -92,7 +85,6 @@
       work w ((closure));
       submit(boost::move(w));
     }
-#endif
 
     template <typename Closure>
     void submit(BOOST_THREAD_RV_REF(Closure) closure)

Modified: trunk/boost/thread/future.hpp
==============================================================================
--- trunk/boost/thread/future.hpp Sat Oct 26 19:25:53 2013 (r86470)
+++ trunk/boost/thread/future.hpp 2013-10-26 19:35:40 EDT (Sat, 26 Oct 2013) (r86471)
@@ -60,15 +60,8 @@
 #include <boost/thread/thread_only.hpp>
 
 #if defined BOOST_THREAD_PROVIDES_FUTURE_WHEN_ALL_WHEN_ANY
-#if ! defined(BOOST_NO_CXX11_HDR_TUPLE)
-#include <tuple>
-#define BOOST_THREAD_TUPLE std::tuple
-#endif
-
-#include <boost/container/vector.hpp>
-#define BOOST_THREAD_VECTOR boost::container::vector
-//#include <vector>
-//#define BOOST_THREAD_VECTOR std::vector
+#include <boost/thread/csbl/tuple.hpp>
+#include <boost/thread/csbl/vector.hpp>
 #endif
 
 #ifdef BOOST_THREAD_PROVIDES_EXECUTORS
@@ -4511,11 +4504,11 @@
     // detail::future_async_when_all_shared_state
     ////////////////////////////////
     template<typename F>
- struct future_when_all_vector_shared_state: future_async_shared_state_base<BOOST_THREAD_VECTOR<F> >
+ struct future_when_all_vector_shared_state: future_async_shared_state_base<csbl::vector<F> >
     {
- typedef BOOST_THREAD_VECTOR<F> vector_type;
+ typedef csbl::vector<F> vector_type;
       typedef typename F::value_type value_type;
- BOOST_THREAD_VECTOR<F> vec_;
+ csbl::vector<F> vec_;
 
       static void run(future_when_all_vector_shared_state* that)
       {
@@ -4551,7 +4544,7 @@
       }
 
       future_when_all_vector_shared_state(vector_tag,
- BOOST_THREAD_RV_REF(BOOST_THREAD_VECTOR<F>) v
+ BOOST_THREAD_RV_REF(csbl::vector<F>) v
       )
       : vec_(boost::move(v))
       {
@@ -4588,11 +4581,11 @@
     // detail::future_async_when_any_shared_state
     ////////////////////////////////
     template<typename F>
- struct future_when_any_vector_shared_state: future_async_shared_state_base<BOOST_THREAD_VECTOR<F> >
+ struct future_when_any_vector_shared_state: future_async_shared_state_base<csbl::vector<F> >
     {
- typedef BOOST_THREAD_VECTOR<F> vector_type;
+ typedef csbl::vector<F> vector_type;
       typedef typename F::value_type value_type;
- BOOST_THREAD_VECTOR<F> vec_;
+ csbl::vector<F> vec_;
 
       static void run(future_when_any_vector_shared_state* that)
       {
@@ -4628,7 +4621,7 @@
       }
 
       future_when_any_vector_shared_state(vector_tag,
- BOOST_THREAD_RV_REF(BOOST_THREAD_VECTOR<F>) v
+ BOOST_THREAD_RV_REF(csbl::vector<F>) v
       )
       : vec_(boost::move(v))
       {
@@ -4661,22 +4654,22 @@
     };
 
 #if ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
-#if ! defined(BOOST_NO_CXX11_HDR_TUPLE)
+//#if ! defined(BOOST_NO_CXX11_HDR_TUPLE)
     template< typename T0, typename ...T>
     struct future_when_all_tuple_shared_state: future_async_shared_state_base<
- BOOST_THREAD_TUPLE<BOOST_THREAD_FUTURE<typename T0::value_type>, BOOST_THREAD_FUTURE<typename T::value_type>... >
+ csbl::tuple<BOOST_THREAD_FUTURE<typename T0::value_type>, BOOST_THREAD_FUTURE<typename T::value_type>... >
>
     {
 
     };
     template< typename T0, typename ...T>
     struct future_when_any_tuple_shared_state: future_async_shared_state_base<
- BOOST_THREAD_TUPLE<BOOST_THREAD_FUTURE<typename T0::value_type>, BOOST_THREAD_FUTURE<typename T::value_type>... >
+ csbl::tuple<BOOST_THREAD_FUTURE<typename T0::value_type>, BOOST_THREAD_FUTURE<typename T::value_type>... >
>
     {
 
     };
-#endif
+//#endif
 #endif
 
 #if ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
@@ -4693,20 +4686,20 @@
     template< typename T0, typename ...T>
     struct when_type_impl<true, T0, T...>
     {
- typedef BOOST_THREAD_VECTOR<typename decay<T0>::type> container_type;
+ typedef csbl::vector<typename decay<T0>::type> container_type;
       typedef typename container_type::value_type value_type;
       typedef detail::future_when_all_vector_shared_state<value_type> factory_all_type;
       typedef detail::future_when_any_vector_shared_state<value_type> factory_any_type;
     };
-#if ! defined(BOOST_NO_CXX11_HDR_TUPLE)
+//#if ! defined(BOOST_NO_CXX11_HDR_TUPLE)
     template< typename T0, typename ...T>
     struct when_type_impl<false, T0, T...>
     {
- typedef BOOST_THREAD_TUPLE<BOOST_THREAD_FUTURE<typename T0::value_type>, BOOST_THREAD_FUTURE<typename T::value_type>... > container_type;
+ typedef csbl::tuple<BOOST_THREAD_FUTURE<typename T0::value_type>, BOOST_THREAD_FUTURE<typename T::value_type>... > container_type;
       typedef detail::future_when_all_tuple_shared_state<T0, T...> factory_all_type;
       typedef detail::future_when_any_tuple_shared_state<T0, T...> factory_any_type;
     };
-#endif
+//#endif
 
     template< typename T0, typename ...T>
     struct when_type : when_type_impl<are_same<T0, T...>::value, T0, T...> {};
@@ -4715,12 +4708,12 @@
 
   template< typename InputIterator>
   typename boost::disable_if<is_future_type<InputIterator>,
- BOOST_THREAD_FUTURE<BOOST_THREAD_VECTOR<typename InputIterator::value_type> >
+ BOOST_THREAD_FUTURE<csbl::vector<typename InputIterator::value_type> >
>::type
   when_all(InputIterator first, InputIterator last)
   {
     typedef typename InputIterator::value_type value_type;
- typedef BOOST_THREAD_VECTOR<value_type> container_type;
+ typedef csbl::vector<value_type> container_type;
     typedef detail::future_when_all_vector_shared_state<value_type> factory_type;
 
     if (first==last) return make_ready_future(container_type());
@@ -4730,12 +4723,12 @@
     return BOOST_THREAD_FUTURE<container_type>(h);
   }
 
-#if ! defined(BOOST_NO_CXX11_HDR_TUPLE)
- BOOST_THREAD_FUTURE<BOOST_THREAD_TUPLE<> > when_all()
+//#if ! defined(BOOST_NO_CXX11_HDR_TUPLE)
+ BOOST_THREAD_FUTURE<csbl::tuple<> > when_all()
   {
- return make_ready_future(BOOST_THREAD_TUPLE<>());
+ return make_ready_future(csbl::tuple<>());
   }
-#endif
+//#endif
 
 #if ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
   template< typename T0, typename ...T>
@@ -4753,12 +4746,12 @@
 
   template< typename InputIterator>
   typename boost::disable_if<is_future_type<InputIterator>,
- BOOST_THREAD_FUTURE<BOOST_THREAD_VECTOR<typename InputIterator::value_type> >
+ BOOST_THREAD_FUTURE<csbl::vector<typename InputIterator::value_type> >
>::type
   when_any(InputIterator first, InputIterator last)
   {
     typedef typename InputIterator::value_type value_type;
- typedef BOOST_THREAD_VECTOR<value_type> container_type;
+ typedef csbl::vector<value_type> container_type;
     typedef detail::future_when_any_vector_shared_state<value_type> factory_type;
 
     if (first==last) return make_ready_future(container_type());
@@ -4768,12 +4761,12 @@
     return BOOST_THREAD_FUTURE<container_type>(h);
   }
 
-#if ! defined(BOOST_NO_CXX11_HDR_TUPLE)
- BOOST_THREAD_FUTURE<BOOST_THREAD_TUPLE<> > when_any()
+//#if ! defined(BOOST_NO_CXX11_HDR_TUPLE)
+ BOOST_THREAD_FUTURE<csbl::tuple<> > when_any()
   {
- return make_ready_future(BOOST_THREAD_TUPLE<>());
+ return make_ready_future(csbl::tuple<>());
   }
-#endif
+//#endif
 
 #if ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
   template< typename T0, typename ...T>

Modified: trunk/boost/thread/thread_pool.hpp
==============================================================================
--- trunk/boost/thread/thread_pool.hpp Sat Oct 26 19:25:53 2013 (r86470)
+++ trunk/boost/thread/thread_pool.hpp 2013-10-26 19:35:40 EDT (Sat, 26 Oct 2013) (r86471)
@@ -18,11 +18,11 @@
 #include <boost/thread/detail/work.hpp>
 
 
-#ifdef BOOST_NO_CXX11_HDR_FUNCTIONAL
-#include <boost/function.hpp>
-#else
-#include <functional>
-#endif
+//#ifdef BOOST_NO_CXX11_HDR_FUNCTIONAL
+//#include <boost/function.hpp>
+//#else
+//#include <functional>
+//#endif
 
 #if defined BOOST_NO_CXX11_RVALUE_REFERENCES
 #include <boost/container/vector.hpp>
@@ -173,38 +173,29 @@
      * \b Throws: \c sync_queue_is_closed if the thread pool is closed.
      * Whatever exception that can be throw while storing the closure.
      */
-#ifndef BOOST_THREAD_USES_NULLARY_FUNCTION_AS_WORK
+
+#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
     template <typename Closure>
- void submit(Closure const & closure)
+ void submit(Closure & closure)
     {
       work w ((closure));
       work_queue.push(boost::move(w));
- //work_queue.push(work(closure));
+ //work_queue.push(work(closure)); // todo check why this doesn't work
     }
-#else
- #if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
- template <typename Closure>
- void submit(Closure & closure)
- {
- work w ((closure));
- work_queue.push(boost::move(w));
- //work_queue.push(work(closure));
- }
- #endif
- void submit(void (*closure)())
- {
- work w ((closure));
- work_queue.push(boost::move(w));
- //work_queue.push(work(closure));
- }
-
 #endif
+ void submit(void (*closure)())
+ {
+ work w ((closure));
+ work_queue.push(boost::move(w));
+ //work_queue.push(work(closure)); // todo check why this doesn't work
+ }
+
     template <typename Closure>
     void submit(BOOST_THREAD_RV_REF(Closure) closure)
     {
       work w =boost::move(closure);
       work_queue.push(boost::move(w));
- //work_queue.push(work(boost::move(closure)));
+ //work_queue.push(work(boost::move(closure))); // todo check why this doesn't work
     }
 
     /**
@@ -216,7 +207,6 @@
     bool reschedule_until(Pred const& pred)
     {
       do {
- //schedule_one_or_yield();
         if ( ! try_executing_one())
         {
           return false;


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