Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r51115 - sandbox/interthreads/boost/interthreads
From: vicente.botet_at_[hidden]
Date: 2009-02-08 16:30:28


Author: viboes
Date: 2009-02-08 16:30:25 EST (Sun, 08 Feb 2009)
New Revision: 51115
URL: http://svn.boost.org/trac/boost/changeset/51115

Log:
interthreads version 0.4
    * New free functions for all the AsynchronousCompletionToken operations, providing a higher degree of freedom.
    * Missing have_all_values(), have_all_exception() and are_all_ready() functions on AsynchronousCompletionToken fusion tuples.
    * get_all: getting all the values from a tuple of AsynchronousCompletionToken works now.
    * fork_after overloaded for a single dependency
    * wait_all overloaded for a single ACT.
    * wait_for_all evaluate one of its elements on the current thread
    * No need to use wait_and_get() on thread_specific_shared_ptr<> to synchronize with the decoration if the thread is created using a AsynchronousExecutor decorator. In this case the synchro is done before returning the AsynchronousCompletionToken. See the tutorial and the mono_thread_id example.

Text files modified:
   sandbox/interthreads/boost/interthreads/act_traits.hpp | 14 +-
   sandbox/interthreads/boost/interthreads/algorithm.hpp | 38 ++++-
   sandbox/interthreads/boost/interthreads/asynchronous_executor_decorator.hpp | 49 +++---
   sandbox/interthreads/boost/interthreads/basic_threader.hpp | 110 +++++++++++++++--
   sandbox/interthreads/boost/interthreads/basic_threader_decorator.hpp | 18 +-
   sandbox/interthreads/boost/interthreads/fork.hpp | 23 ++-
   sandbox/interthreads/boost/interthreads/fork_after.hpp | 119 ++++++++++++++----
   sandbox/interthreads/boost/interthreads/fork_all.hpp | 77 ++++++++++-
   sandbox/interthreads/boost/interthreads/future_traits.hpp | 18 +-
   sandbox/interthreads/boost/interthreads/launcher.hpp | 200 +++++++------------------------
   sandbox/interthreads/boost/interthreads/scheduler.hpp | 150 +++++++++++++++++++----
   sandbox/interthreads/boost/interthreads/set_once.hpp | 46 +++---
   sandbox/interthreads/boost/interthreads/thread_algo.hpp | 20 +-
   sandbox/interthreads/boost/interthreads/thread_and_join.hpp | 84 ++++++------
   sandbox/interthreads/boost/interthreads/thread_decoration.hpp | 48 +++---
   sandbox/interthreads/boost/interthreads/thread_decorator.hpp | 59 ++++----
   sandbox/interthreads/boost/interthreads/thread_group_once.hpp | 58 ++++----
   sandbox/interthreads/boost/interthreads/thread_keep_alive.hpp | 90 ++++++-------
   sandbox/interthreads/boost/interthreads/thread_specific_shared_ptr.hpp | 254 ++++++++++++++++++++--------------------
   sandbox/interthreads/boost/interthreads/thread_tuple.hpp | 208 ++++++++++++++++----------------
   sandbox/interthreads/boost/interthreads/thread_tuple_once.hpp | 98 +++++++-------
   sandbox/interthreads/boost/interthreads/threader.hpp | 227 ++++++++++++++++++-----------------
   sandbox/interthreads/boost/interthreads/threader_decorator.hpp | 12
   sandbox/interthreads/boost/interthreads/wait_for_all.hpp | 48 ++++++-
   sandbox/interthreads/boost/interthreads/wait_for_any.hpp | 58 ++++----
   25 files changed, 1194 insertions(+), 932 deletions(-)

Modified: sandbox/interthreads/boost/interthreads/act_traits.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/act_traits.hpp (original)
+++ sandbox/interthreads/boost/interthreads/act_traits.hpp 2009-02-08 16:30:25 EST (Sun, 08 Feb 2009)
@@ -3,9 +3,9 @@
 
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Vicente J. Botet Escriba 2008-20009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// (C) Copyright Vicente J. Botet Escriba 2008-2009.
+// 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)
 //
 // Based on the threader/joiner design from of Kevlin Henney (n1883)
@@ -31,7 +31,7 @@
 
     template<typename ACT>
     struct act_traits;
-
+
     template <typename ACT>
     struct is_movable : mpl::false_{};
 
@@ -44,13 +44,13 @@
     template <typename AE, typename T>
     struct asynchronous_completion_token {
         typedef typename AE::template handle<T>::type type;
- };
+ };
 
     template <typename AE>
     struct get_future {
         template <typename T>
- shared_future<T>& operator()(typename asynchronous_completion_token<AE,T>::type& act) {
- return act.get_future();
+ shared_future<T>& operator()(typename asynchronous_completion_token<AE,T>::type& act) {
+ return act.get_future();
         }
     };
 

Modified: sandbox/interthreads/boost/interthreads/algorithm.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/algorithm.hpp (original)
+++ sandbox/interthreads/boost/interthreads/algorithm.hpp 2009-02-08 16:30:25 EST (Sun, 08 Feb 2009)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Vicente J. Botet Escriba 2008-20009. Distributed under the Boost
+// (C) Copyright Vicente J. Botet Escriba 2008-2009. 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)
 //
@@ -12,22 +12,46 @@
 #define BOOST_INTERTHREADS_ALGORITHM__HPP
 
 #include <boost/interthreads/fork.hpp>
+//#include <boost/interthreads/lazy_fork.hpp>
 #include <boost/interthreads/fork_after.hpp>
 #include <boost/interthreads/fork_all.hpp>
 #include <boost/interthreads/wait_for_all.hpp>
 #include <boost/interthreads/wait_for_any.hpp>
-#include <boost/interthreads/algorithm/detach_all.hpp>
-#include <boost/interthreads/algorithm/interrupt_all.hpp>
-#include <boost/interthreads/algorithm/interruption_requested_on_all.hpp>
+
+#include <boost/interthreads/algorithm/join.hpp>
+#include <boost/interthreads/algorithm/join_until.hpp>
+//#include <boost/interthreads/algorithm/join_all_for.hpp>
+#include <boost/interthreads/algorithm/joinable.hpp>
+#include <boost/interthreads/algorithm/detach.hpp>
+#include <boost/interthreads/algorithm/interrupt.hpp>
+#include <boost/interthreads/algorithm/interruption_requested.hpp>
+
 #include <boost/interthreads/algorithm/join_all.hpp>
 #include <boost/interthreads/algorithm/join_all_until.hpp>
 //#include <boost/interthreads/algorithm/join_all_for.hpp>
-//#include <boost/interthreads/algorithm/get_all.hpp>
-//#include <boost/interthreads/algorithm/get_all_until.hpp>
-//#include <boost/interthreads/algorithm/get_all_for.hpp>
+#include <boost/interthreads/algorithm/are_all_joinable.hpp>
+#include <boost/interthreads/algorithm/detach_all.hpp>
+#include <boost/interthreads/algorithm/interrupt_all.hpp>
+#include <boost/interthreads/algorithm/interruption_requested_on_all.hpp>
+
+#include <boost/interthreads/algorithm/wait.hpp>
+#include <boost/interthreads/algorithm/wait_until.hpp>
+//#include <boost/interthreads/algorithm/wait_all_for.hpp>
+#include <boost/interthreads/algorithm/get.hpp>
+#include <boost/interthreads/algorithm/get_until.hpp>
+#include <boost/interthreads/algorithm/is_ready.hpp>
+#include <boost/interthreads/algorithm/has_value.hpp>
+#include <boost/interthreads/algorithm/has_exception.hpp>
+
 #include <boost/interthreads/algorithm/wait_all.hpp>
 #include <boost/interthreads/algorithm/wait_all_until.hpp>
 //#include <boost/interthreads/algorithm/wait_all_for.hpp>
+#include <boost/interthreads/algorithm/get_all.hpp>
+//#include <boost/interthreads/algorithm/get_all_until.hpp>
+//#include <boost/interthreads/algorithm/get_all_for.hpp>
+#include <boost/interthreads/algorithm/are_all_ready.hpp>
+#include <boost/interthreads/algorithm/have_all_value.hpp>
+#include <boost/interthreads/algorithm/have_all_exception.hpp>
 
 
 #endif

Modified: sandbox/interthreads/boost/interthreads/asynchronous_executor_decorator.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/asynchronous_executor_decorator.hpp (original)
+++ sandbox/interthreads/boost/interthreads/asynchronous_executor_decorator.hpp 2009-02-08 16:30:25 EST (Sun, 08 Feb 2009)
@@ -3,9 +3,9 @@
 
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Vicente J. Botet Escriba 2008-20009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// (C) Copyright Vicente J. Botet Escriba 2008-2009.
+// 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)
 //
 // See http://www.boost.org/libs/interthreads for documentation.
@@ -14,21 +14,20 @@
 
 #include <boost/utility/result_of.hpp>
 
-
 #include <boost/config/abi_prefix.hpp>
 
 namespace boost {
 namespace interthreads {
-
+
     template <typename AE, template <class> class Decorator>
     struct asynchronous_executor_decorator : AE {
         template <typename T>
         struct handle {
- typedef typename AE::template handle<T>::type type;
+ typedef typename asynchronous_completion_token<AE, T>::type type;
         };
-
+
         template <typename F>
- typename AE::template handle< typename boost::result_of<F()>::type >::type
+ typename AE::template handle< typename boost::result_of<F()>::type >::type
         fork( F fn ) {
             typename result_of::fork<AE, F>::type act= this->AE::fork(Decorator<typename boost::result_of<F()>::type>(fn));
             return boost::move(act);
@@ -36,40 +35,40 @@
 
         asynchronous_executor_decorator() :AE() {};
 
- template <typename Nullary>
-#ifdef BOOST_THREAD_HAS_THREAD_ATTR
- asynchronous_executor_decorator(thread::native_handle_attr_type& attr, Nullary f)
+ template <typename Nullary>
+#ifdef BOOST_THREAD_HAS_THREAD_ATTR
+ asynchronous_executor_decorator(thread::native_handle_attr_type& attr, Nullary f)
         : AE(attr, f)
 #else
- asynchronous_executor_decorator(Nullary f)
+ asynchronous_executor_decorator(Nullary f)
         : AE(f)
-#endif
- {}
+#endif
+ {}
 
     // move support
 #ifdef BOOST_HAS_RVALUE_REFS
-#else
- asynchronous_executor_decorator(boost::detail::thread_move_t<asynchronous_executor_decorator> x)
+#else
+ asynchronous_executor_decorator(boost::detail::thread_move_t<asynchronous_executor_decorator> x)
             : AE(boost::move(*(static_cast<AE*>(&(x.member))))) {}
-
+
     asynchronous_executor_decorator& operator=(boost::detail::thread_move_t<asynchronous_executor_decorator> x) {
         return move();
     }
 
     operator boost::detail::thread_move_t<asynchronous_executor_decorator>() {
         return move();
- }
+ }
 
     boost::detail::thread_move_t<asynchronous_executor_decorator> move() {
             return boost::detail::thread_move_t<asynchronous_executor_decorator>(*this);
- }
-
-#endif
+ }
+
+#endif
+
 
-
     };
 
-
+
     template <typename AE, template <class> class Decorator>
     struct get_future<asynchronous_executor_decorator<AE, Decorator> > {
         template <typename T>
@@ -77,8 +76,8 @@
             typedef typename AE::template get_future<AE>::type type;
         };
         template <typename T>
- typename future_type<T>::type&
- operator()(typename AE::template handle<T>::type & j)
+ typename future_type<T>::type&
+ operator()(typename AE::template handle<T>::type & j)
         { return j.get_future(); }
     };
 

Modified: sandbox/interthreads/boost/interthreads/basic_threader.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/basic_threader.hpp (original)
+++ sandbox/interthreads/boost/interthreads/basic_threader.hpp 2009-02-08 16:30:25 EST (Sun, 08 Feb 2009)
@@ -3,9 +3,9 @@
 
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Vicente J. Botet Escriba 2008-20009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// (C) Copyright Vicente J. Botet Escriba 2008-2009.
+// 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)
 //
 // Based on the threader/joiner design from of Kevlin Henney (n1883)
@@ -17,7 +17,7 @@
 #include <boost/thread/detail/move.hpp>
 #include <boost/thread/thread.hpp>
 
-#include <boost/interthreads/fork.hpp>
+#include <boost/interthreads/algorithm.hpp>
 
 #include <boost/config/abi_prefix.hpp>
 
@@ -27,38 +27,120 @@
 
 
 class basic_threader {
-#ifdef BOOST_THREAD_HAS_THREAD_ATTR
+#ifdef BOOST_THREAD_HAS_THREAD_ATTR
 private:
     thread::native_handle_attr_type attr_;
 public:
     thread::native_handle_attr_type& attr() {
         return attr_;
     }
-#endif
+#endif
 
-public:
+public:
     template <typename T>
     struct handle {
         typedef thread type;
     };
 
     template <typename F>
- thread
- fork(F f) {
-#ifdef BOOST_THREAD_HAS_THREAD_ATTR
+ thread fork(F f) {
+#ifdef BOOST_THREAD_HAS_THREAD_ATTR
         thread th(attr(), f);
 #else
         thread th(f);
-#endif
- return boost::move(th);
- }
+#endif
+ return boost::move(th);
+ }
 };
 
     template<>
     struct act_traits<thread > {
             typedef void move_dest_type;
     };
-
+
+ template <>
+ struct is_movable<thread > : mpl::true_{};
+
+ template <>
+ struct has_future_if<thread > : mpl::true_{};
+
+ template <>
+ struct has_thread_if<thread > : mpl::true_{};
+
+ namespace partial_specialization_workaround {
+ #if 0
+ template<typename F >
+ struct fork<basic_threader, F> {
+ static boost::detail::thread_move_t<typename result_of::fork<AE,F>::type> apply(basic_threader& ae, F fn ) {
+ return ae.fork(fn);
+ }
+ };
+ #endif
+ template <>
+ struct wait<thread> {
+ static result_of::wait<thread>::type apply( thread& act) {
+ return act.join();
+ }
+ };
+ template<>
+ struct wait<boost::detail::thread_move_t<thread> > {
+ static result_of::wait<thread>::type apply( boost::detail::thread_move_t<thread> act ) {
+ return act->join();
+ }
+ };
+
+ template <>
+ struct wait_until<thread> {
+ static result_of::wait_until<thread>::type apply( thread& act, const system_time& abs_time ) {
+ return act.timed_join(abs_time);
+ }
+ };
+ template <>
+ struct wait_until<boost::detail::thread_move_t<thread> > {
+ static result_of::wait_until<thread>::type apply( boost::detail::thread_move_t<thread> act, const system_time& abs_time ) {
+ return act->timed_join(abs_time);
+ }
+ };
+ template <typename Duration>
+ struct wait_for<thread, Duration> {
+ static typename result_of::template wait_for<thread,Duration>::type apply( thread& act, Duration abs_time ) {
+ return act.timed_join(abs_time);
+ }
+ };
+
+ template <typename Duration>
+ struct wait_for<boost::detail::thread_move_t<thread>, Duration> {
+ static typename result_of::template wait_for<thread,Duration>::type apply( boost::detail::thread_move_t<thread> act, Duration abs_time ) {
+ return act->timed_join(abs_time);
+ }
+ };
+
+ template <>
+ struct join_until<thread> {
+ static result_of::join_until<thread>::type apply( thread& act, const system_time& abs_time ) {
+ return act.timed_join(abs_time);
+ }
+ };
+ template <>
+ struct join_until<boost::detail::thread_move_t<thread> >{
+ static result_of::join_until<thread>::type apply( boost::detail::thread_move_t<thread> act, const system_time& abs_time ) {
+ return act->timed_join(abs_time);
+ }
+ };
+ template <typename Duration>
+ struct join_for<thread, Duration> {
+ static typename result_of::template join_for<thread,Duration>::type apply( thread& act, Duration abs_time ) {
+ return act.timed_join(abs_time);
+ }
+ };
+ template <typename Duration>
+ struct join_for<boost::detail::thread_move_t<thread>, Duration> {
+ static typename result_of::template join_for<thread,Duration>::type apply( boost::detail::thread_move_t<thread> act, Duration abs_time ) {
+ return act->timed_join(abs_time);
+ }
+ };
+ }
+
 
 }
 }

Modified: sandbox/interthreads/boost/interthreads/basic_threader_decorator.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/basic_threader_decorator.hpp (original)
+++ sandbox/interthreads/boost/interthreads/basic_threader_decorator.hpp 2009-02-08 16:30:25 EST (Sun, 08 Feb 2009)
@@ -3,10 +3,10 @@
 
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Roland Schwarz 2006.
-// (C) Copyright Vicente J. Botet Escriba 2008-20009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// (C) Copyright Roland Schwarz 2006.
+// (C) Copyright Vicente J. Botet Escriba 2008-2009.
+// 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)
 //
 // Extension of the init class of the threadalert library of Roland Schwarz
@@ -15,8 +15,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#include <boost/interthreads/asynchronous_executor_decorator.hpp>
-#include <boost/interthreads/thread_decorator.hpp>
+#include <boost/interthreads/asynchronous_executor_wait_decorator.hpp>
+#include <boost/interthreads/wait_thread_decorator.hpp>
 #include <boost/interthreads/basic_threader.hpp>
 
 
@@ -24,10 +24,10 @@
 
 namespace boost {
 namespace interthreads {
-
 
- typedef asynchronous_executor_decorator<basic_threader,thread_decorator> basic_threader_decorator;
-
+
+ typedef asynchronous_executor_wait_decorator<basic_threader,thread_decorator> basic_threader_decorator;
+
 }
 }
 

Modified: sandbox/interthreads/boost/interthreads/fork.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/fork.hpp (original)
+++ sandbox/interthreads/boost/interthreads/fork.hpp 2009-02-08 16:30:25 EST (Sun, 08 Feb 2009)
@@ -3,9 +3,9 @@
 
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Vicente J. Botet Escriba 2008-20009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// (C) Copyright Vicente J. Botet Escriba 2008-2009.
+// 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)
 //
 // Based on the threader/joiner design from of Kevlin Henney (n1883)
@@ -26,30 +26,33 @@
 namespace interthreads {
 
 
-
-namespace result_of {
+
+namespace result_of {
     template <typename AE,typename F>
     struct fork {
         typedef typename boost::result_of<F()>::type result_type;
         typedef typename asynchronous_completion_token<AE, result_type>::type type;
     };
 }
-
+
 namespace partial_specialization_workaround {
-template< typename AE, typename F >
+template< typename AE, typename F >
 struct fork {
     static typename result_of::fork<AE,F>::type apply(AE& ae, F fn ) {
         return ae.fork(fn);
     }
 };
 }
-template< typename AE, typename F >
-typename result_of::fork<AE,F>::type
+
+template< typename AE, typename F >
+// typename boost::disable_if<is_movable_only<ACT>,
+ typename result_of::fork<AE,F>::type
+// >::type
 fork( AE& ae, F fn ) {
     return partial_specialization_workaround::fork<AE,F>::apply(ae,fn);
 }
 
-template< typename AE, typename F, typename A1 >
+template< typename AE, typename F, typename A1 >
 typename asynchronous_completion_token<AE, typename boost::result_of<F(A1)>::type >::type
 fork( AE& ae, F fn, A1 a1 ) {
     return ae.fork( bind( fn, a1 ) );

Modified: sandbox/interthreads/boost/interthreads/fork_after.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/fork_after.hpp (original)
+++ sandbox/interthreads/boost/interthreads/fork_after.hpp 2009-02-08 16:30:25 EST (Sun, 08 Feb 2009)
@@ -3,9 +3,9 @@
 
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Vicente J. Botet Escriba 2008-20009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// (C) Copyright Vicente J. Botet Escriba 2008-2009.
+// 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)
 //
 // Based on the threader/joiner design from of Kevlin Henney (n1883)
@@ -26,6 +26,12 @@
 #include <boost/thread/locks.hpp>
 #include <boost/shared_ptr.hpp>
 
+#ifdef BOOST_HAS_CHRONO_LIB
+#include <boost/chono/chono.hpp>
+#else
+#include <boost/thread/thread_time.hpp>
+#endif
+
 #include <boost/config/abi_prefix.hpp>
 
 
@@ -43,7 +49,7 @@
 template <typename ACT>
 struct act_wrapper {
     typedef typename act_traits<act_wrapper<ACT> >::move_dest_type move_dest_type;
-
+
     act_wrapper() :ptr_(new data()) {}
     void wait_initialized() {
         while (!ptr_->inittialized_) {
@@ -71,19 +77,78 @@
         ptr_->act_.wait();
     }
 
+ bool wait_until(const system_time& abs_time) {
+ wait_initialized();
+ return ptr_->act_.wait_until(abs_time);
+ }
+
+ template <typename Duration>
+ bool wait_for(ACT& act, Duration rel_time) {
+ wait_initialized();
+ return ptr_->act_.wait_for(rel_time);
+ }
+
     move_dest_type get() {
         wait_initialized();
         return ptr_->act_.get();
     }
 
+ bool is_ready() {
+ wait_initialized();
+ return ptr_->act_.is_ready();
+ }
+
+ bool has_value() {
+ wait_initialized();
+ return ptr_->act_.has_value();
+ }
+
+ bool has_exception() {
+ wait_initialized();
+ return ptr_->act_.has_exception();
+ }
+
+ void detach() {
+ wait_initialized();
+ ptr_->act_.detach();
+ }
+
+ bool joinable() {
+ wait_initialized();
+ return ptr_->act_.joinable();
+ }
+
     void join() {
         wait_initialized();
         ptr_->act_.join();
     }
-private:
+
+ bool join_until(const system_time& abs_time) {
+ wait_initialized();
+ return ptr_->act_.join_until(abs_time);
+ }
+
+ template <typename Duration>
+ bool join_for(ACT& act, Duration rel_time) {
+ wait_initialized();
+ return ptr_->act_.join_for(rel_time);
+ }
+
+ void interrupt() {
+ wait_initialized();
+ ptr_->act_.interrupt();
+ }
+
+ bool interruption_requested() {
+ wait_initialized();
+ return ptr_->act_.interruption_requested();
+ }
+
+
+private:
     struct data {
- data()
- : inittialized_(false)
+ data()
+ : inittialized_(false)
         {}
         ACT act_;
         bool inittialized_;
@@ -104,7 +169,7 @@
 struct has_thread_if<act_wrapper<ACT> > : has_thread_if<ACT>{};
 
 
-namespace result_of {
+namespace result_of {
     template <typename AE,typename F>
     struct fork_after {
         typedef typename boost::result_of<F()>::type result_type;
@@ -114,7 +179,7 @@
 }
 
 #else
-namespace result_of {
+namespace result_of {
     template <typename AE,typename F>
     struct fork_after {
         typedef void type;
@@ -125,7 +190,7 @@
 struct call_f_after {
     typedef void result_type;
 #ifndef ACT_WRAPPER
- void operator()(AE& ae, F fn, D& d,
+ void operator()(AE& ae, F fn, D& d,
         typename asynchronous_completion_token<AE,typename boost::result_of<F()>::type>::type& h
     ) {
         //d.wait();
@@ -140,23 +205,25 @@
         //d.wait();
         boost::interthreads::wait_all(d);
         typename asynchronous_completion_token<AE,typename boost::result_of<F()>::type>::type tmp = fork(ae, fn);
- h.set(boost::move(tmp));
+ h.set(tmp);
+ //h.set(boost::move(tmp));
+
     }
 #endif
 };
 
 namespace partial_specialization_workaround {
-template< typename AE, typename F, typename D >
+template< typename AE, typename F, typename D >
 struct fork_after {
 #ifndef ACT_WRAPPER
- static void
- apply(AE& ae, F fn, D& d,
+ static void
+ apply(AE& ae, F fn, D& d,
         typename asynchronous_completion_token<AE,typename boost::result_of<F()>::type>::type& h
     ) {
         call_f_after<AE,F,D> f;
         boost::interthreads::fork(ae, boost::bind(f, boost::ref(ae), fn, boost::ref(d), boost::ref(h)));
     }
-#else
+#else
     static typename result_of::fork_after<AE,F>::type
     apply(AE& ae, F fn, D& d) {
         act_wrapper<
@@ -166,42 +233,42 @@
         boost::interthreads::fork(ae, boost::bind(f, boost::ref(ae), fn, boost::ref(d), boost::ref(h)));
         return h;
     }
-#endif
+#endif
 };
 }
-template< typename AE, typename F, typename D>
+template< typename AE, typename F, typename D>
 #ifndef ACT_WRAPPER
-void
-fork_after( AE& ae, F fn, D& d,
+void
+fork_after( AE& ae, F fn, D& d,
     typename asynchronous_completion_token<AE,typename boost::result_of<F()>::type>::type& h) {
     return partial_specialization_workaround::fork_after<AE,F,D>::apply(ae,fn, d, h);
 }
-#else
-typename result_of::fork_after<AE,F>::type
+#else
+typename result_of::fork_after<AE,F>::type
 fork_after( AE& ae, F fn, D& d) {
     return partial_specialization_workaround::fork_after<AE,F,D>::apply(ae,fn, d);
 }
-#endif
+#endif
 
-template< typename AE, typename D, typename F>
+template< typename AE, typename D, typename F>
 act_wrapper< typename asynchronous_completion_token<AE, typename boost::result_of<F()>::type >::type >
 after_completion_fork( AE& ae, D& d, F fn) {
     return fork_after(ae, fn, d );
 }
 
-template< typename AE, typename D, typename F, typename A1 >
+template< typename AE, typename D, typename F, typename A1 >
 act_wrapper< typename asynchronous_completion_token<AE, typename boost::result_of<F(A1)>::type >::type >
 after_completion_fork( AE& ae, D& d, F fn, A1 a1 ) {
     return fork_after(ae, bind( fn, a1 ), d );
 }
 
-template< typename AE, typename D, typename F, typename A1, typename A2 >
+template< typename AE, typename D, typename F, typename A1, typename A2 >
 act_wrapper< typename asynchronous_completion_token<AE, typename boost::result_of<F(A1,A2)>::type >::type >
 after_completion_fork( AE& ae, D& d, F fn, A1 a1, A2 a2 ) {
     return fork_after(ae, bind( fn, a1, a2 ), d );
 }
 
-template< typename AE, typename D, typename F, typename A1, typename A2, typename A3 >
+template< typename AE, typename D, typename F, typename A1, typename A2, typename A3 >
 act_wrapper< typename asynchronous_completion_token<AE, typename boost::result_of<F(A1,A2,A3)>::type >::type >
 after_completion_fork( AE& ae, D& d, F fn, A1 a1, A2 a2, A3 a3 ) {
     return fork_after(ae, bind( fn, a1, a2, a3 ), d );

Modified: sandbox/interthreads/boost/interthreads/fork_all.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/fork_all.hpp (original)
+++ sandbox/interthreads/boost/interthreads/fork_all.hpp 2009-02-08 16:30:25 EST (Sun, 08 Feb 2009)
@@ -3,9 +3,9 @@
 
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Vicente J. Botet Escriba 2008-20009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// (C) Copyright Vicente J. Botet Escriba 2008-2009.
+// 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)
 //
 // Based on the threader/joiner design from of Kevlin Henney (n1883)
@@ -25,8 +25,47 @@
 namespace boost {
 namespace interthreads {
 
-
-namespace result_of {
+#if 0
+ namespace fct {
+ template <typename AE, typename F>
+ struct fork {
+ fork(AE& ae, F f);
+ template <typename Sig>
+ struct result;
+
+ template <typename T>
+ struct result<fork(T)>
+ {
+ typename asynchronous_completion_token<AE, typename boost::result_of<F(T)>::type >::type type;
+ };
+
+ template <typename T>
+ typename typename asynchronous_completion_token<AE, typename boost::result_of<F(T)>::type >::type operator()(T& act) const {
+ return typename asynchronous_completion_token<AE, typename boost::result_of<F(T)>::type >::type();
+ }
+ };
+
+ template <typename AE, typename F>
+ struct set_fork {
+ set_fork(AE& ae, F f);
+ template<typename Sig>
+ struct result;
+
+ template<typename T>
+ struct result<set_fork(T)>
+ {
+ typedef void type;
+ };
+
+ template<typename PARAM_ACT>
+ void operator()(PARAM_ACT param_act) const {
+ fusion::at_c<1>(param_act)=interthreads::fork(fusion::at_c<0>(param_act));
+ }
+ };
+ }
+
+#endif
+namespace result_of {
     template <typename AE, typename T>
     struct fork_all;
     template <typename AE, typename F1>
@@ -50,11 +89,11 @@
             typename fork<AE,F3>::type
> type;
     };
-
+
 }
 
 
-template< typename AE, typename F1>
+template< typename AE, typename F1>
 typename result_of::fork_all<AE, fusion::tuple<F1> >::type
 fork_all( AE& ae, F1 f1 ) {
     typedef typename result_of::fork_all<AE, fusion::tuple<F1> >::type type;
@@ -62,7 +101,7 @@
     return type(j1);
 }
 
-template< typename AE, typename F1, typename F2>
+template< typename AE, typename F1, typename F2>
 typename result_of::fork_all<AE, fusion::tuple<F1,F2> >::type
 fork_all( AE& ae, F1 f1, F2 f2 ) {
     typedef typename result_of::fork_all<AE, fusion::tuple<F1,F2> >::type type;
@@ -71,7 +110,27 @@
     return type(j1,j2);
 }
 
-template< typename AE, typename F1, typename F2, typename F3>
+#if 0
+
+ template <typename AE, typename F, typename SequenceHandles, typename SequenceValues>
+ void set_fork_all(AE& ae, F f, SequenceValues& values, SequenceHandles& handles) {
+ typedef fusion::vector<SequenceValues&, SequenceHandles&> sequences;
+ sequences seqs(values, handles);
+ fusion::zip_view<sequences> zip(seqs);
+ fusion::for_each(zip, fct::set_fork_all(ae, f));
+ }
+
+template< typename AE, typename F, typename Sequence>
+typename result_of::template fork_all_seq<AE, F, Sequence>::type
+fork_all_apply( AE& ae, F f, Sequence seq ) {
+ typename result_of::template fork_all_seq<AE, F, Sequence>::type res=
+ fusion::as_vector(fusion::transform(seq, fct::fork(ae, f)));
+ set_fork_all(seq, res);
+ return res;
+}
+#endif
+
+template< typename AE, typename F1, typename F2, typename F3>
 typename result_of::fork_all<AE, fusion::tuple<F1,F2,F3> >::type
 fork_all( AE& ae, F1 f1, F2 f2, F3 f3 ) {
     typedef typename result_of::fork_all<AE, fusion::tuple<F1,F2,F3> >::type type;

Modified: sandbox/interthreads/boost/interthreads/future_traits.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/future_traits.hpp (original)
+++ sandbox/interthreads/boost/interthreads/future_traits.hpp 2009-02-08 16:30:25 EST (Sun, 08 Feb 2009)
@@ -3,9 +3,9 @@
 
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Vicente J. Botet Escriba 2008-20009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// (C) Copyright Vicente J. Botet Escriba 2008-2009.
+// 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)
 //
 // Based on the threader/joiner design from of Kevlin Henney (n1883)
@@ -48,7 +48,7 @@
             {
                 storage.reset(new T(t));
             }
-
+
             static void init(storage_type& storage,rvalue_source_type t)
             {
                 storage.reset(new T(static_cast<rvalue_source_type>(t)));
@@ -59,7 +59,7 @@
                 storage.reset();
             }
         };
-
+
         template<typename T>
         struct act_traits<unique_future<T&> >
         {
@@ -96,7 +96,7 @@
                 storage=false;
             }
 
- };
+ };
 
         template<typename T>
         struct act_traits<shared_future<T> >
@@ -117,7 +117,7 @@
             {
                 storage.reset(new T(t));
             }
-
+
             static void init(storage_type& storage,rvalue_source_type t)
             {
                 storage.reset(new T(static_cast<rvalue_source_type>(t)));
@@ -128,7 +128,7 @@
                 storage.reset();
             }
         };
-
+
         template<typename T>
         struct act_traits<shared_future<T&> >
         {
@@ -165,7 +165,7 @@
                 storage=false;
             }
 
- };
+ };
 
 }
 }

Modified: sandbox/interthreads/boost/interthreads/launcher.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/launcher.hpp (original)
+++ sandbox/interthreads/boost/interthreads/launcher.hpp 2009-02-08 16:30:25 EST (Sun, 08 Feb 2009)
@@ -3,9 +3,9 @@
 
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Vicente J. Botet Escriba 2008-20009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// (C) Copyright Vicente J. Botet Escriba 2008-2009.
+// 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)
 //
 // Based on the threader/joiner design from of Kevlin Henney (n1883)
@@ -19,7 +19,7 @@
 #include <boost/futures/future.hpp>
 #include <boost/utility/result_of.hpp>
 
-#include <boost/interthreads/fork.hpp>
+#include <boost/interthreads/algorithm.hpp>
 #include <boost/interthreads/act_traits.hpp>
 #include <boost/interthreads/future_traits.hpp>
 
@@ -29,18 +29,17 @@
 namespace boost {
 namespace interthreads {
 
-
 class launcher {
-#ifdef BOOST_THREAD_HAS_THREAD_ATTR
+#ifdef BOOST_THREAD_HAS_THREAD_ATTR
 private:
     thread::native_handle_attr_type attr_;
 public:
     thread::native_handle_attr_type& attr() {
         return attr_;
     }
-#endif
+#endif
 
-public:
+public:
     template <typename T>
     struct handle {
         typedef unique_future<T> type;
@@ -51,28 +50,29 @@
     fork(F f) {
         typedef typename boost::result_of<F()>::type result_type;
         packaged_task<result_type> tsk(f);
- unique_future<result_type> res = tsk.get_future();
-#ifdef BOOST_THREAD_HAS_THREAD_ATTR
+ unique_future<result_type> act = tsk.get_future();
+#ifdef BOOST_THREAD_HAS_THREAD_ATTR
         thread th(attr(), boost::move(tsk));
 #else
         thread th(boost::move(tsk));
-#endif
- return boost::move(res);
- }
+#endif
+ return boost::move(act);
+ }
+
 };
 
 
 class shared_launcher {
-#ifdef BOOST_THREAD_HAS_THREAD_ATTR
+#ifdef BOOST_THREAD_HAS_THREAD_ATTR
 private:
     thread::native_handle_attr_type attr_;
 public:
     thread::native_handle_attr_type& attr() {
         return attr_;
     }
-#endif
+#endif
 
-public:
+public:
     template <typename T>
     struct handle {
         typedef shared_future<T> type;
@@ -83,14 +83,15 @@
     fork(F f) {
         typedef typename boost::result_of<F()>::type result_type;
         packaged_task<result_type> tsk(f);
- shared_future<result_type> res(tsk.get_future());
-#ifdef BOOST_THREAD_HAS_THREAD_ATTR
+ shared_future<result_type> act(tsk.get_future());
+#ifdef BOOST_THREAD_HAS_THREAD_ATTR
         thread th(attr(), boost::move(tsk));
 #else
         thread th(boost::move(tsk));
-#endif
- return res;
- }
+#endif
+ return act;
+ }
+
 };
 
 template <>
@@ -122,7 +123,7 @@
 template <typename R>
 struct has_thread_if<unique_future<R> > : mpl::false_{};
 
-
+
 template <typename R>
 struct is_movable<shared_future<R> > : mpl::true_{};
 
@@ -130,149 +131,42 @@
 struct has_future_if<shared_future<R> > : mpl::true_{};
 
 template <typename R>
-struct has_thread_if<shared_future<R> > : mpl::false_{};
-
-
-#if 0
- template<typename T>
- struct act_traits<unique_future<T> >
- {
- typedef boost::scoped_ptr<T> storage_type;
-#ifdef BOOST_HAS_RVALUE_REFS
- typedef T const& source_reference_type;
- struct dummy;
- typedef typename boost::mpl::if_<boost::is_fundamental<T>,dummy&,T&&>::type rvalue_source_type;
- typedef typename boost::mpl::if_<boost::is_fundamental<T>,T,T&&>::type move_dest_type;
-#else
- typedef T& source_reference_type;
- typedef typename boost::mpl::if_<boost::is_convertible<T&,boost::detail::thread_move_t<T> >,boost::detail::thread_move_t<T>,T const&>::type rvalue_source_type;
- typedef typename boost::mpl::if_<boost::is_convertible<T&,boost::detail::thread_move_t<T> >,boost::detail::thread_move_t<T>,T>::type move_dest_type;
-#endif
+struct has_thread_if<shared_future<R> > : mpl::true_{};
 
- static void init(storage_type& storage,source_reference_type t)
- {
- storage.reset(new T(t));
- }
-
- static void init(storage_type& storage,rvalue_source_type t)
- {
- storage.reset(new T(static_cast<rvalue_source_type>(t)));
- }
-
- static void cleanup(storage_type& storage)
- {
- storage.reset();
+ namespace partial_specialization_workaround {
+ template <typename R>
+ struct join<shared_future<R> > {
+ static typename result_of::template join<shared_future<R> >::type apply( shared_future<R>& act) {
+ return act.wait();
             }
         };
-
- template<typename T>
- struct act_traits<unique_future<T&> >
- {
- typedef T* storage_type;
- typedef T& source_reference_type;
- struct rvalue_source_type
- {};
- typedef T& move_dest_type;
-
- static void init(storage_type& storage,T& t)
- {
- storage=&t;
- }
-
- static void cleanup(storage_type& storage)
- {
- storage=0;
+ template <typename R>
+ struct join_until<shared_future<R> > {
+ static typename result_of::template join_until<shared_future<R> >::type apply( shared_future<R>& act, const system_time& abs_time ) {
+ return act.timed_wait_until(abs_time);
             }
         };
-
- template<>
- struct act_traits<unique_future<void> >
- {
- typedef bool storage_type;
- typedef void move_dest_type;
-
- static void init(storage_type& storage)
- {
- storage=true;
- }
-
- static void cleanup(storage_type& storage)
- {
- storage=false;
- }
-
- };
-
- template<typename T>
- struct act_traits<shared_future<T> >
- {
- typedef boost::scoped_ptr<T> storage_type;
-#ifdef BOOST_HAS_RVALUE_REFS
- typedef T const& source_reference_type;
- struct dummy;
- typedef typename boost::mpl::if_<boost::is_fundamental<T>,dummy&,T&&>::type rvalue_source_type;
-#else
- typedef T& source_reference_type;
- typedef typename boost::mpl::if_<boost::is_convertible<T&,boost::detail::thread_move_t<T> >,boost::detail::thread_move_t<T>,T const&>::type rvalue_source_type;
-#endif
- //typedef const T& move_dest_type;
- typedef T move_dest_type;
-
- static void init(storage_type& storage,source_reference_type t)
- {
- storage.reset(new T(t));
- }
-
- static void init(storage_type& storage,rvalue_source_type t)
- {
- storage.reset(new T(static_cast<rvalue_source_type>(t)));
- }
-
- static void cleanup(storage_type& storage)
- {
- storage.reset();
+ template <typename R, typename Duration>
+ struct join_for<shared_future<R>, Duration> {
+ static typename result_of::template join_for<shared_future<R>,Duration>::type apply( shared_future<R>& act, Duration rel_time ) {
+ return act.timed_wait(rel_time);
             }
         };
-
- template<typename T>
- struct act_traits<shared_future<T&> >
- {
- typedef T* storage_type;
- typedef T& source_reference_type;
- struct rvalue_source_type
- {};
- typedef T& move_dest_type;
-
- static void init(storage_type& storage,T& t)
- {
- storage=&t;
- }
-
- static void cleanup(storage_type& storage)
- {
- storage=0;
+ template <typename R>
+ struct wait_until<shared_future<R> > {
+ static typename result_of::template wait_until<shared_future<R> >::type apply( shared_future<R>& act, const system_time& abs_time ) {
+ return act.timed_wait_until(abs_time);
             }
         };
-
- template<>
- struct act_traits<shared_future<void> >
- {
- typedef bool storage_type;
- typedef void move_dest_type;
-
- static void init(storage_type& storage)
- {
- storage=true;
- }
-
- static void cleanup(storage_type& storage)
- {
- storage=false;
+ template <typename R, typename Duration>
+ struct wait_for<shared_future<R>, Duration> {
+ static typename result_of::template wait_for<shared_future<R>,Duration>::type apply( shared_future<R>& act, Duration rel_time ) {
+ return act.timed_wait(rel_time);
             }
+ };
+ }
 
- };
 
-#endif
 }
 }
 

Modified: sandbox/interthreads/boost/interthreads/scheduler.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/scheduler.hpp (original)
+++ sandbox/interthreads/boost/interthreads/scheduler.hpp 2009-02-08 16:30:25 EST (Sun, 08 Feb 2009)
@@ -3,9 +3,9 @@
 
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Vicente J. Botet Escriba 2008-20009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// (C) Copyright Vicente J. Botet Escriba 2008-2009.
+// 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)
 //
 // Based on the unique_threader/unique_joiner design from of Kevlin Henney (n1883)
@@ -16,7 +16,7 @@
 
 #include <boost/thread/detail/move.hpp>
 #include <boost/thread/condition_variable.hpp>
-#include <boost/thread/thread.hpp>
+//#include <boost/thread/thread.hpp>
 #include <boost/thread/tss.hpp>
 #include <boost/shared_ptr.hpp>
 #include <boost/bind.hpp>
@@ -25,29 +25,47 @@
 #include <boost/futures/future.hpp>
 #include <boost/utility/result_of.hpp>
 
-#include <boost/interthreads/fork.hpp>
+#include <boost/interthreads/algorithm.hpp>
 
 #include <boost/config/abi_prefix.hpp>
 
+namespace boost
+{
+#ifdef TASK_POOL
+ template<typename Pool, typename T>
+ boost::tp::task<Pool, T>& move(boost::tp::task<Pool, T>& t)
+#else
+ template<typename T>
+ boost::tp::task<T>& move(boost::tp::task<T>& t)
+#endif
+ {
+ return t;
+ }
+}
+
 
 namespace boost {
 namespace interthreads {
 
-
+#if 0
 template <typename C>
 class scheduler {
     tp::pool<C> _pool;
-public:
+public:
     explicit scheduler(
         tp::poolsize const& psize
     ) : _pool(psize)
     {};
     template <typename T>
     struct handle {
+#ifdef TASK_POOL
+ typedef typename tp::pool<C>::template handle<T>::type type;
+#else
         typedef tp::task<T> type;
+#endif
     };
     template <typename F>
- tp::task<typename boost::result_of<F()>::type>
+ typename handle<typename boost::result_of<F()>::type>::type
     fork(F f) {
         return _pool.submit(f);
     }
@@ -65,30 +83,57 @@
 };
 
 
+#endif
+
 
 template <typename Channel, typename T>
 struct asynchronous_completion_token<boost::tp::pool<Channel>,T> {
+#ifdef TASK_POOL
+ typedef typename tp::template pool<Channel>::template handle<T>::type type;
+#else
     typedef boost::tp::task<T> type;
-};
+#endif
+};
 
 
 namespace partial_specialization_workaround {
-template< typename Channel, typename F >
-struct fork<boost::tp::pool<Channel>,F> {
- static typename result_of::fork<boost::tp::pool<Channel>, F>::type
- apply( boost::tp::pool<Channel>& ae, F fn ) {
- return ae.submit(fn);
- }
-};
-
+ template< typename Channel, typename F >
+ struct fork<boost::tp::pool<Channel>,F> {
+ static typename result_of::fork<boost::tp::pool<Channel>, F>::type
+ apply( boost::tp::pool<Channel>& ae, F fn ) {
+ return ae.submit(fn);
+ }
+ };
 }
+
 template <typename C>
 struct get_future<tp::pool<C> > {
     template <typename T>
- shared_future<T>& operator()(tp::task<T>& act) { return act.get_future(); }
+ shared_future<T>& operator()(
+#ifdef TASK_POOL
+ //typename asynchronous_completion_token<tp::pool<C>,T>::type & act
+ tp::task<tp::pool<C>, T>& act
+#else
+ tp::task<T>& act
+#endif
+ ) { return act.get_future(); }
+};
+
+#ifdef TASK_POOL
+template <typename Pool, typename ResultType>
+struct act_traits< tp::task<Pool, ResultType> > {
+ typedef ResultType move_dest_type;
 };
 
+template <typename Pool, typename R>
+struct is_movable<tp::task<Pool, R> > : mpl::false_{};
 
+template <typename Pool, typename R>
+struct has_future_if<tp::task<Pool, R> > : mpl::true_{};
+
+template <typename Pool, typename R>
+struct has_thread_if<tp::task<Pool, R> > : mpl::true_{};
+#else
 template <typename ResultType>
 struct act_traits< tp::task<ResultType> > {
     typedef ResultType move_dest_type;
@@ -101,22 +146,69 @@
 struct has_future_if<tp::task<R> > : mpl::true_{};
 
 template <typename R>
-struct has_thread_if<tp::task<R> > : mpl::false_{};
+struct has_thread_if<tp::task<R> > : mpl::true_{};
+#endif
 
-}
-}
+#ifdef TASK_POOL
 
-#if 1
-namespace boost
-{
- template<typename T>
- boost::tp::task<T>& move(boost::tp::task<T>& t)
- {
- return t;
+ namespace partial_specialization_workaround {
+ template <typename Pool, typename R>
+ struct join<tp::task<Pool, R> > {
+ static typename result_of::template join<tp::task<Pool, R> >::type apply( tp::task<Pool, R>& act) {
+ return act.wait();
+ }
+ };
+ template <typename Pool, typename R>
+ struct join_until<tp::task<Pool, R> > {
+ static typename result_of::template join_until<tp::task<Pool, R> >::type apply( tp::task<Pool, R>& act, const system_time& abs_time ) {
+ return act.wait_until(abs_time);
+ }
+ };
+ template <typename Pool, typename R, typename Duration>
+ struct join_for<tp::task<Pool, R>, Duration> {
+ static typename result_of::template join_for<tp::task<Pool, R>,Duration>::type apply( tp::task<Pool, R>& act, Duration rel_time ) {
+ return interthreads::join_until(act, get_system_time()+rel_time );
+ }
+ };
+ template <typename Pool, typename R, typename Duration>
+ struct wait_for<tp::task<Pool, R>, Duration> {
+ static typename result_of::template wait_for<tp::task<Pool, R>,Duration>::type apply( tp::task<Pool, R>& act, Duration rel_time ) {
+ return interthreads::wait_until(act, get_system_time()+rel_time );
+ }
+ };
+ }
+#else
+ namespace partial_specialization_workaround {
+ template <typename R>
+ struct join<tp::task<R> > {
+ static typename result_of::template join<tp::task<R> >::type apply( tp::task<R>& act) {
+ return act.wait();
+ }
+ };
+ template <typename R>
+ struct join_until<tp::task<R> > {
+ static typename result_of::template join_until<tp::task<R> >::type apply( tp::task<R>& act, const system_time& abs_time ) {
+ return act.wait_until(abs_time);
+ }
+ };
+ template <typename R, typename Duration>
+ struct join_for<tp::task<R>, Duration> {
+ static typename result_of::template join_for<tp::task<R>,Duration>::type apply( tp::task<R>& act, Duration abs_time ) {
+ return interthreads::wait_until(act, get_system_time()+abs_time);
+ }
+ };
+ template <typename R, typename Duration>
+ struct wait_for<tp::task<R>, Duration> {
+ static typename result_of::template wait_for<tp::task<R>,Duration>::type apply( tp::task<R>& act, Duration abs_time ) {
+ return interthreads::wait_until(act, get_system_time()+abs_time);
+ }
+ };
     }
-}
 
 #endif
+}
+}
+
 #include <boost/config/abi_suffix.hpp>
 
 #endif

Modified: sandbox/interthreads/boost/interthreads/set_once.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/set_once.hpp (original)
+++ sandbox/interthreads/boost/interthreads/set_once.hpp 2009-02-08 16:30:25 EST (Sun, 08 Feb 2009)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Vicente J. Botet Escriba 2008-20009. Distributed under the Boost
+// (C) Copyright Vicente J. Botet Escriba 2008-2009. 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)
 //
@@ -52,7 +52,7 @@
             assigned_=false;
             return val_;
         }
-
+
         std::pair<bool,value_type> get_until(const system_time& until) {
             boost::unique_lock<boost::mutex> lock(mutex_);
             bool res = assigned_;
@@ -64,42 +64,42 @@
         bool set_value_if_unassigned(value_type val) {
             boost::unique_lock<boost::mutex> lock(mutex_);
             if (!assigned_) { /*< first post assigns the current thread id >*/
- assigned_=true;
- val_ = val;
- cond_.notify_all();
- return true;
+ assigned_=true;
+ val_ = val;
+ cond_.notify_all();
+ return true;
             } else { /*< the other settings are ignored >*/
- return false;
+ return false;
             }
         }
-
+
         template<typename F>
- //static typename boost::enable_if<is_void<typename result_of<F()>::type>,void>::type
+ //static typename boost::enable_if<is_void<typename result_of<F()>::type>,void>::type
         void
- decorator(this_type& once, T value, F fct) {
- fct();
- once.set_value_if_unassigned(value);
+ decorator(this_type& once, T value, F fct) {
+ fct();
+ once.set_value_if_unassigned(value);
         }
 
         template<typename F>
- //static typename boost::disable_if<is_void<typename result_of<F()>::type>, typename result_of<F()>::type>::type
+ //static typename boost::disable_if<is_void<typename result_of<F()>::type>, typename result_of<F()>::type>::type
         typename result_of<F()>::type
- decoratorT(this_type& once, T value, F fct) {
- typename result_of<F()>::type res =fct();
- once.set_value_if_unassigned(value);
+ decoratorT(this_type& once, T value, F fct) {
+ typename result_of<F()>::type res =fct();
+ once.set_value_if_unassigned(value);
             return res;
         }
         template<typename F>
- boost::detail::thread_move_t<thread> fork(T value, F fct) {
+ boost::detail::thread_move_t<thread> fork(T value, F fct) {
             thread tmp_thread(bind(decorator<F>, ref(*this), value, fct));
- return tmp_thread;
- }
+ return tmp_thread;
+ }
 
         template<typename F>
- static boost::detail::thread_move_t<thread> make_thread(this_type& once, T value, F fct) {
+ static boost::detail::thread_move_t<thread> make_thread(this_type& once, T value, F fct) {
             thread tmp_thread(bind(decorator<F>, ref(once), value, fct));
- return tmp_thread;
- }
+ return tmp_thread;
+ }
 
     private:
         mutex mutex_;
@@ -107,7 +107,7 @@
         bool assigned_;
         value_type val_;
     };
-}
+}
 } // namespace boost
 #include <boost/config/abi_suffix.hpp>
 

Modified: sandbox/interthreads/boost/interthreads/thread_algo.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/thread_algo.hpp (original)
+++ sandbox/interthreads/boost/interthreads/thread_algo.hpp 2009-02-08 16:30:25 EST (Sun, 08 Feb 2009)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Vicente J. Botet Escriba 2008-20009. Distributed under the Boost
+// (C) Copyright Vicente J. Botet Escriba 2008-2009. 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)
 //
@@ -30,7 +30,7 @@
 namespace boost {
 namespace interthreads {
 
- template <typename THREADS>
+ template <typename THREADS>
     bool joinables(THREADS& threads) const {
         for (std::size_t i=0; i<threads.size(); i++) {
             if (!threads[i].joinable()) return false;
@@ -38,14 +38,14 @@
         return true;
     }
 
- template <typename THREADS>
+ template <typename THREADS>
     void join_all(THREADS& threads) {
         for (std::size_t i=0; i<threads.size(); i++) {
             threads[i].join();
         }
     }
 
- template <typename THREADS>
+ template <typename THREADS>
     bool join_all_until(THREADS& threads, const system_time& wait_until) {
         for (std::size_t i=0; i<threads.size(); i++) {
             if (!threads[i].timed_join(wait_until)) return false;
@@ -59,30 +59,30 @@
         return join_all_until(get_system_time()+rel_time);
     }
 
- template <typename THREADS>
+ template <typename THREADS>
     void detach_all(THREADS& threads) {
         for (std::threads.sizet i=0; i<threads.size; i++) {
             threads[i].detach();
         }
     }
-
- template <typename THREADS>
+
+ template <typename THREADS>
     void interrupt_all(THREADS& threads) {
         for (std::threads.sizet i=0; i<threads.size; i++) {
             threads[i].interrupt();
         }
     }
 
- template <typename THREADS>
+ template <typename THREADS>
     bool interruption_requested(THREADS& threads) const {
         for (std::threads.sizet i=0; i<threads.size; i++) {
             if (!threads[i].interruption_requested()) return false;
         }
         return true;
     }
-
 
-}
+
+}
 } // namespace boost
 
 #include <boost/config/abi_suffix.hpp>

Modified: sandbox/interthreads/boost/interthreads/thread_and_join.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/thread_and_join.hpp (original)
+++ sandbox/interthreads/boost/interthreads/thread_and_join.hpp 2009-02-08 16:30:25 EST (Sun, 08 Feb 2009)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Vicente J. Botet Escriba 2008-20009. Distributed under the Boost
+// (C) Copyright Vicente J. Botet Escriba 2008-2009. 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)
 //
@@ -23,118 +23,118 @@
 namespace boost {
 namespace interthreads {
 
-#if 0
-template <typename F>
+#if 0
+template <typename F>
 struct par {
-
-};
 
-par(f1) || f2
+};
+
+par(f1) || f2
 
 #endif
 
     template<typename F1, typename F2>
     inline void conc_join_all(F1 f1, F2 f2)
     {
- thread_tuple<2> stg(f1, f2);
- stg.join_all();
+ thread_tuple<2> stg(f1, f2);
+ stg.join_all();
     }
-
-#if 0
+
+#if 0
     template<typename F0, typename F1>
     tuple<
         typename result_of<F0()>::type
- , typename result_of<F1()>::type
- >
+ , typename result_of<F1()>::type
+ >
     conc_all(F0 f0, F1 f1)
     {
- future_tuple<typename result_of<F0()>::type, typename result_of<F1()>::type > ft(f0, f1);
- return ft.get_all();
- }
+ future_tuple<typename result_of<F0()>::type, typename result_of<F1()>::type > ft(f0, f1);
+ return ft.get_all();
+ }
 #endif
 
     template<typename F1, typename F2, typename F3>
     inline void conc_join_all(F1 f1, F2 f2, F3 f3)
     {
- thread_tuple<3> stg(f1, f2, f3);
- stg.join_all();
+ thread_tuple<3> stg(f1, f2, f3);
+ stg.join_all();
     }
 
     template<typename F1, typename F2>
     inline void conc_join_all_until(const system_time& wait_until, F1 f1, F2 f2)
     {
- thread_tuple<2> stg(f1, f2);
- stg.join_all_until(wait_until);
+ thread_tuple<2> stg(f1, f2);
+ stg.join_all_until(wait_until);
     }
-
+
     template<typename F1, typename F2, typename F3>
     inline void conc_join_all_until(const system_time& wait_until, F1 f1, F2 f2, F3 f3)
     {
- thread_tuple<3> stg(f1, f2, f3);
- stg.join_all_until(wait_until);
+ thread_tuple<3> stg(f1, f2, f3);
+ stg.join_all_until(wait_until);
     }
-
+
     template<typename TimeDuration, typename F1, typename F2>
     inline std::size_t conc_join_all_for(TimeDuration wait_for, F1 f1, F2 f2)
     {
         return conc_join_all_until(get_system_time()+wait_for, f1, f2);
     }
-
+
     template<typename TimeDuration, typename F1, typename F2, typename F3>
     inline std::size_t conc_join_all_for(TimeDuration wait_for, F1 f1, F2 f2, F3 f3)
     {
         return conc_join_all_until(get_system_time()+wait_for, f1, f2, f3);
     }
-
-
+
+
     template<typename F1, typename F2>
     inline std::size_t conc_join_any(F1 f1, F2 f2)
     {
- thread_tuple_once<2> stg(f1, f2);
- std::size_t res= stg.join_any();
- stg.interrupt_all();
+ thread_tuple_once<2> stg(f1, f2);
+ std::size_t res= stg.join_any();
+ stg.interrupt_all();
         return res;
     }
-
+
     template<typename F1, typename F2, typename F3>
     inline std::size_t conc_join_any(F1 f1, F2 f2, F3 f3)
     {
- thread_tuple_once<3> stg(f1, f2, f3);
- std::size_t res= stg.join_any();
- stg.interrupt_all();
+ thread_tuple_once<3> stg(f1, f2, f3);
+ std::size_t res= stg.join_any();
+ stg.interrupt_all();
         return res;
     }
 
     template<typename F1, typename F2>
     inline std::size_t conc_join_any_until(const system_time& wait_until, F1 f1, F2 f2)
     {
- thread_tuple_once<2> stg(f1, f2);
- std::pair<bool,std::size_t> res= stg.join_any_until(wait_until);
+ thread_tuple_once<2> stg(f1, f2);
+ std::pair<bool,std::size_t> res= stg.join_any_until(wait_until);
         if (res.first) stg.interrupt_all();
         return res;
     }
-
+
     template<typename F1, typename F2, typename F3>
     inline std::size_t conc_join_any_until(const system_time& wait_until, F1 f1, F2 f2, F3 f3)
     {
- thread_tuple_once<3> stg(f1, f2, f3);
- std::pair<bool,std::size_t> res= stg.join_any_until(wait_until);
- if (res.first) stg.interrupt_all();
+ thread_tuple_once<3> stg(f1, f2, f3);
+ std::pair<bool,std::size_t> res= stg.join_any_until(wait_until);
+ if (res.first) stg.interrupt_all();
         return res;
     }
-
+
     template<typename TimeDuration, typename F1, typename F2>
     inline std::size_t conc_join_any_for(TimeDuration wait_for, F1 f1, F2 f2)
     {
         return conc_join_any_until(get_system_time()+wait_for, f1, f2);
     }
-
+
     template<typename TimeDuration, typename F1, typename F2, typename F3>
     inline std::size_t conc_join_any_for(TimeDuration wait_for, F1 f1, F2 f2, F3 f3)
     {
         return conc_join_any_until(get_system_time()+wait_for, f1, f2, f3);
     }
-}
+}
 } // namespace boost
 
 #include <boost/config/abi_suffix.hpp>

Modified: sandbox/interthreads/boost/interthreads/thread_decoration.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/thread_decoration.hpp (original)
+++ sandbox/interthreads/boost/interthreads/thread_decoration.hpp 2009-02-08 16:30:25 EST (Sun, 08 Feb 2009)
@@ -3,10 +3,10 @@
 
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Roland Schwarz 2006.
-// (C) Copyright Vicente J. Botet Escriba 2008-20009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// (C) Copyright Roland Schwarz 2006.
+// (C) Copyright Vicente J. Botet Escriba 2008-2009.
+// 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)
 //
 // Extension of the init class of the threadalert library of Roland Schwarz
@@ -29,31 +29,31 @@
 namespace boost {
 namespace interthreads {
     class thread_decoration {
- thread_decoration();
- thread_decoration(const thread_decoration&);
+ thread_decoration();
+ thread_decoration(const thread_decoration&);
     public:
- template<typename Callable1>
- thread_decoration(Callable1 setup)
- : setup_(new detail::decorator_function<Callable1>(setup))
+ template<typename Callable1>
+ thread_decoration(Callable1 setup)
+ : setup_(new detail::decorator_function<Callable1>(setup))
             , cleanup_(0)
             , prev_(last_) {
- // the constructor is not thread-safe so it must only be used on
- // global objects which are constructed before any threads
- last_ = this;
- }
-
- template<typename Callable1,typename Callable2>
- thread_decoration(Callable1 setup, Callable2 cleanup)
- : setup_(new detail::decorator_function<Callable1>(setup))
+ // the constructor is not thread-safe so it must only be used on
+ // global objects which are constructed before any threads
+ last_ = this;
+ }
+
+ template<typename Callable1,typename Callable2>
+ thread_decoration(Callable1 setup, Callable2 cleanup)
+ : setup_(new detail::decorator_function<Callable1>(setup))
 // , cleanup_(new detail::decorator_function<Callable2>(cleanup))
             , cleanup_(cleanup)
             , prev_(last_) {
- // the constructor is not thread-safe so it must only be used on
- // global objects which are constructed before any threads
- last_ = this;
- }
-
- ~thread_decoration() {
+ // the constructor is not thread-safe so it must only be used on
+ // global objects which are constructed before any threads
+ last_ = this;
+ }
+
+ ~thread_decoration() {
             delete setup_;
         }
         static void BOOST_INTERTHREADS_DECL decorate();
@@ -67,7 +67,7 @@
         thread_decoration* prev_;
     };
 
-
+
 }
 }
 

Modified: sandbox/interthreads/boost/interthreads/thread_decorator.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/thread_decorator.hpp (original)
+++ sandbox/interthreads/boost/interthreads/thread_decorator.hpp 2009-02-08 16:30:25 EST (Sun, 08 Feb 2009)
@@ -3,10 +3,10 @@
 
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Roland Schwarz 2006.
-// (C) Copyright Vicente J. Botet Escriba 2008-20009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// (C) Copyright Roland Schwarz 2006.
+// (C) Copyright Vicente J. Botet Escriba 2008-2009.
+// 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)
 //
 // Extension of the init class of the threadalert library of Roland Schwarz
@@ -44,14 +44,14 @@
         basic_thread_decorator(const basic_thread_decorator& other) {
             func_ =other.func_;
         }
-
+
         basic_thread_decorator& operator=(const basic_thread_decorator& other) {
             basic_thread_decorator tmp(other);
             tmp.swap(*this);
             return *this;
         }
 
-#if defined(BOOST_HAS_VARIADIC_TMPL)
+#if defined(BOOST_HAS_VARIADIC_TMPL)
 #if defined(BOOST_HAS_RVALUE_REFS)
         template <typename Callable, typename Arg...>
         explicit basic_thread_decorator(Callable&& f, ...Arg&& args)
@@ -66,7 +66,7 @@
         template <typename Callable>
         explicit basic_thread_decorator(Callable&& f)
             : func_(detail::make_decorator_function(static_cast<F&&>(f))) {};
-#else // !defined(BOOST_HAS_RVALUE_REFS)
+#else // !defined(BOOST_HAS_RVALUE_REFS)
 #ifdef BOOST_INTERTHREADS_THREAD_DECORATOR_MOVE
 #ifndef BOOST_NO_SFINAE
         template <class Callable>
@@ -84,31 +84,31 @@
         template <class Callable>
         explicit basic_thread_decorator(Callable f): func_(detail::make_decorator_function(f)) {}
 #endif // ! BOOST_INTERTHREADS_THREAD_DECORATOR_MOVE
-
-
+
+
         template <typename Callable, typename A1>
         basic_thread_decorator(Callable f, A1 a1)
             : func_(detail::make_decorator_function(boost::bind(boost::type<void>(),f,a1))) {};
-
+
         template <typename Callable, typename A1, typename A2>
         basic_thread_decorator(Callable f, A1 a1, A2 a2)
             : func_(detail::make_decorator_function(boost::bind(boost::type<void>(),f,a1,a2))) {};
-
+
         template <typename Callable, typename A1, typename A2, typename A3>
         basic_thread_decorator(Callable f, A1 a1, A2 a2, A3 a3)
             : func_(detail::make_decorator_function(boost::bind(boost::type<void>(),f,a1,a2,a3))) {};
-
+
         template <typename Callable, typename A1, typename A2, typename A3, typename A4>
         basic_thread_decorator(Callable f, A1 a1, A2 a2, A3 a3, A4 a4)
             : func_(detail::make_decorator_function(boost::bind(boost::type<void>(),f,a1,a2,a3,a4))) {};
 #endif
-#endif
+#endif
         // move semantics
 #if defined(BOOST_HAS_RVALUE_REFS)
         basic_thread_decorator(basic_thread_decorator&& other) {
             func_.swap(other.func_);
         }
-
+
         basic_thread_decorator& operator=(basic_thread_decorator&& other) {
             func_=other.func_;
             other.func_.reset();
@@ -118,34 +118,35 @@
         basic_thread_decorator&& move() {
             return static_cast<basic_thread_decorator&&>(*this);
         }
-
+
 #else // ! defined(BOOST_HAS_RVALUE_REFS)
 #ifdef BOOST_INTERTHREADS_THREAD_DECORATOR_MOVE
         basic_thread_decorator(boost::detail::thread_move_t<basic_thread_decorator> x) {
             func_=x->func_;
             x->func_.reset();
         }
-
+
         basic_thread_decorator& operator=(boost::detail::thread_move_t<basic_thread_decorator> x) {
             basic_thread_decorator new_decorator(x);
             swap(new_decorator);
             return *this;
         }
-
+
         operator boost::detail::thread_move_t<basic_thread_decorator>() {
             return move();
         }
-
+
         boost::detail::thread_move_t<basic_thread_decorator> move() {
             boost::detail::thread_move_t<basic_thread_decorator> x(*this);
             return x;
         }
-#endif // ! BOOST_INTERTHREADS_THREAD_DECORATOR_MOVE
+#endif // ! BOOST_INTERTHREADS_THREAD_DECORATOR_MOVE
 #endif // ! defined(BOOST_HAS_RVALUE_REFS)
 
         void swap(basic_thread_decorator& x) {
             func_.swap(x.func_);
- }
+ }
+
         T operator()() const {
             decorate();
             return (*func_)();
@@ -153,30 +154,30 @@
     private:
         boost::shared_ptr<detail::decorator_function_base<T> > func_;
     };
-
+
     typedef basic_thread_decorator<void> thread_decorator;
-
+
     template <class F>
     basic_thread_decorator<typename boost::result_of<F()>::type> make_decorator(F f) {
 #ifdef BOOST_INTERTHREADS_THREAD_DECORATOR_MOVE
         return move(basic_thread_decorator<typename boost::result_of<F()>::type>(f));
 #else
         return basic_thread_decorator<typename boost::result_of<F()>::type>(f);
-#endif
+#endif
     }
-
+
     template <class F>
 #ifdef BOOST_HAS_RVALUE_REFS
- thread&&
+ thread&&
 #else
- boost::detail::thread_move_t<thread>
-#endif
+ boost::detail::thread_move_t<thread>
+#endif
     create_decorated_thread(F f) {
         return thread(make_decorator(f));
- }
+ }
 
     inline void decorate() {thread_decoration::decorate();}
-
+
 }
 }
 

Modified: sandbox/interthreads/boost/interthreads/thread_group_once.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/thread_group_once.hpp (original)
+++ sandbox/interthreads/boost/interthreads/thread_group_once.hpp 2009-02-08 16:30:25 EST (Sun, 08 Feb 2009)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Vicente J. Botet Escriba 2008-20009. Distributed under the Boost
+// (C) Copyright Vicente J. Botet Escriba 2008-2009. 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)
 //
@@ -24,39 +24,39 @@
     class thread_group_once
     {
     public:
- inline thread_group_once() {}
- inline ~thread_group_once() {
-#if 0
+ inline thread_group_once() {}
+ inline ~thread_group_once() {
+#if 0
             detach_all();
-#endif
+#endif
         }
 
         template<typename F>
         thread* create_thread(F threadfunc) {
             std::auto_ptr<thread> new_thread(new thread());
- *new_thread = set_once_type::make_thread(once(), new_thread.get(), threadfunc);
+ *new_thread = set_once_type::make_thread(once(), new_thread.get(), threadfunc);
             grp().add_thread(new_thread.get());
             return new_thread.release();
         }
-
+
         void remove_thread(thread* thrd) {
             grp().remove_thread(thrd);
         }
 
         void join_all() {
- once().wait();
+ once().wait();
             grp().join_all();
         }
 
-#if 0
+#if 0
         bool joinable() const {
- return grp.joinable();
+ return grp.joinable();
         }
-#endif
+#endif
 
-#if 0
+#if 0
         bool join_all_until(const system_time& wait_until) {
- return grp.timed_join(wait_until);
+ return grp.timed_join(wait_until);
         }
 
         template<typename TimeDuration>
@@ -67,11 +67,11 @@
 
 #endif
         thread* join_any() {
- return once().get();
+ return once().get();
         }
 
         std::pair<bool,thread*> join_any_until(const system_time& wait_until) {
- return once().get_until(wait_until);
+ return once().get_until(wait_until);
         }
 
         template<typename TimeDuration>
@@ -80,42 +80,42 @@
             return join_any_until(get_system_time()+rel_time);
         }
 
-#if 0
+#if 0
         void detach_all() {
- grp().detach();
+ grp().detach();
         }
 
 #endif
-
+
         void interrupt_all() {
- grp().interrupt_all();
+ grp().interrupt_all();
         }
 
-#if 0
+#if 0
         bool interruption_requested() const {
- grp().interruption_requested();
+ grp().interruption_requested();
         }
 #endif
-
+
         inline std::size_t size() const { return grp().size(); }
-
+
     private:
- thread_group_once(thread_group_once&);
+ thread_group_once(thread_group_once&);
         thread_group_once& operator=(thread_group_once&);
     protected:
         typedef set_once<thread*> set_once_type;
         struct thread_group_once_data {
- set_once_type once_;
- boost::thread_group grp_;
+ set_once_type once_;
+ boost::thread_group grp_;
         };
         thread_group_once_data data_;
         set_once_type& once() { return data_.once_; }
         boost::thread_group& grp() {return data_.grp_;}
         const boost::thread_group& grp() const {return data_.grp_;}
-
- };
 
-}
+ };
+
+}
 } // namespace boost
 #include <boost/config/abi_suffix.hpp>
 

Modified: sandbox/interthreads/boost/interthreads/thread_keep_alive.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/thread_keep_alive.hpp (original)
+++ sandbox/interthreads/boost/interthreads/thread_keep_alive.hpp 2009-02-08 16:30:25 EST (Sun, 08 Feb 2009)
@@ -3,9 +3,9 @@
 
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Vicente J. Botet Escriba 2008-20009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// (C) Copyright Vicente J. Botet Escriba 2008-2009.
+// 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)
 //
 // See http://www.boost.org/libs/interthreads for documentation.
@@ -19,55 +19,51 @@
 
 namespace boost {
 namespace interthreads {
- typedef void (*on_dead_thread_type)(thread::id, thread*);
- namespace detail {
- struct BOOST_INTERTHREADS_DECL thread_keep_alive_internal {
- bool enabled_;
- std::size_t periods_;
- std::size_t checkins_;
- std::size_t total_periods_;
- std::size_t required_checkins_;
- on_dead_thread_type on_dead_;
- thread* thread_ptr_;
- thread_keep_alive_internal();
- };
- }
-namespace this_thread {
-
- class BOOST_INTERTHREADS_DECL enable_keep_alive
- {
- enable_keep_alive(const enable_keep_alive&);
- enable_keep_alive& operator=(const enable_keep_alive&);
-
- detail::thread_keep_alive_internal *backup_;
- detail::thread_keep_alive_internal data_;
- public:
- enable_keep_alive(std::size_t periods=2, std::size_t checkins=1);
- ~enable_keep_alive();
- };
-
- class BOOST_INTERTHREADS_DECL disable_keep_alive
- {
- disable_keep_alive(const disable_keep_alive&);
- disable_keep_alive& operator=(const disable_keep_alive&);
-
- detail::thread_keep_alive_internal *backup_;
- detail::thread_keep_alive_internal data_;
- public:
- disable_keep_alive();
- ~disable_keep_alive();
- };
+ typedef void (*on_dead_thread_type)(thread::id, thread*);
+ namespace detail {
+ struct BOOST_INTERTHREADS_DECL thread_keep_alive_internal {
+ bool enabled_;
+ std::size_t periods_;
+ std::size_t checkins_;
+ std::size_t total_periods_;
+ std::size_t required_checkins_;
+ thread_keep_alive_internal();
+ };
+ }
+ namespace this_thread {
+
+ class BOOST_INTERTHREADS_DECL enable_keep_alive {
+ enable_keep_alive(const enable_keep_alive&);
+ enable_keep_alive& operator=(const enable_keep_alive&);
+
+ detail::thread_keep_alive_internal *backup_;
+ detail::thread_keep_alive_internal data_;
+ public:
+ enable_keep_alive(std::size_t periods=2, std::size_t checkins=1);
+ ~enable_keep_alive();
+ };
+
+ class BOOST_INTERTHREADS_DECL disable_keep_alive {
+ disable_keep_alive(const disable_keep_alive&);
+ disable_keep_alive& operator=(const disable_keep_alive&);
+
+ detail::thread_keep_alive_internal *backup_;
+ detail::thread_keep_alive_internal data_;
+ public:
+ disable_keep_alive();
+ ~disable_keep_alive();
+ };
 
- void BOOST_INTERTHREADS_DECL keep_alive_point();
- bool BOOST_INTERTHREADS_DECL keep_alive_enabled();
+ void BOOST_INTERTHREADS_DECL keep_alive_point();
+ bool BOOST_INTERTHREADS_DECL keep_alive_enabled();
 
- void BOOST_INTERTHREADS_DECL set_on_dead_thread(on_dead_thread_type fct, thread* th=0);
-
-}
+ void BOOST_INTERTHREADS_DECL set_on_dead_thread(on_dead_thread_type fct, thread* th=0);
+
+ } // this_thread
 
     bool BOOST_INTERTHREADS_DECL keep_alive_enabled(thread::id);
 
- void BOOST_INTERTHREADS_DECL set_on_dead_thread(thread::id, on_dead_thread_type fct, thread* th=0);
+ void BOOST_INTERTHREADS_DECL set_on_dead_thread(thread::id, on_dead_thread_type fct, thread* th=0);
 
 }
 }

Modified: sandbox/interthreads/boost/interthreads/thread_specific_shared_ptr.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/thread_specific_shared_ptr.hpp (original)
+++ sandbox/interthreads/boost/interthreads/thread_specific_shared_ptr.hpp 2009-02-08 16:30:25 EST (Sun, 08 Feb 2009)
@@ -3,15 +3,15 @@
 
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Roland Schwarz 2006.
-// (C) Copyright Vicente J. Botet Escriba 2008-20009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// (C) Copyright Roland Schwarz 2006.
+// (C) Copyright Vicente J. Botet Escriba 2008-2009.
+// 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)
 //
 // See http://www.boost.org/libs/interthreads for documentation.
 //
-// Based on the thmemptr from the threadalert library of Roland Schwarz
+// Based on the thmemptr from the threadalert library of Roland Schwarz
 //
 //////////////////////////////////////////////////////////////////////////////
 
@@ -29,85 +29,85 @@
 
 namespace boost {
 namespace interthreads {
-
+
     template <typename T>
     class thread_specific_shared_ptr {
     public:
- typedef shared_ptr<T> shared_ptr_type;
- typedef std::map<thread::id, shared_ptr_type> map_type;
- typedef mutex mutex_type;
- typedef unique_lock<mutex_type> lock_type;
+ typedef shared_ptr<T> shared_ptr_type;
+ typedef std::map<thread::id, shared_ptr_type> map_type;
+ typedef mutex mutex_type;
+ typedef unique_lock<mutex_type> lock_type;
     private:
- typedef condition_variable condition_type;
-
- thread_specific_shared_ptr(thread_specific_shared_ptr&);
- thread_specific_shared_ptr& operator=(thread_specific_shared_ptr&);
-
- typedef thread_specific_shared_ptr<T> this_type;
- struct tss_type
- {
- explicit tss_type(this_type& type, void (*cleanup)(shared_ptr_type))
- : type_(type)
- , shptr_()
+ typedef condition_variable condition_type;
+
+ thread_specific_shared_ptr(thread_specific_shared_ptr&);
+ thread_specific_shared_ptr& operator=(thread_specific_shared_ptr&);
+
+ typedef thread_specific_shared_ptr<T> this_type;
+ struct tss_type
+ {
+ explicit tss_type(this_type& type, void (*cleanup)(shared_ptr_type))
+ : type_(type)
+ , shptr_()
             , cleanup_(cleanup)
- {}
- thread_specific_shared_ptr<T>& type_;
- shared_ptr_type shptr_;
+ {}
+ thread_specific_shared_ptr<T>& type_;
+ shared_ptr_type shptr_;
             void (*cleanup_)(shared_ptr_type);
- };
- typedef thread_specific_ptr<tss_type> tss_ptr_type;
-
- mutable mutex_type monitor_;
- mutable condition_type mapchanged_;
- mutable tss_ptr_type tss_ptr_;
- map_type tmap_;
+ };
+ typedef thread_specific_ptr<tss_type> tss_ptr_type;
+
+ mutable mutex_type monitor_;
+ mutable condition_type mapchanged_;
+ mutable tss_ptr_type tss_ptr_;
+ map_type tmap_;
         void (*cleanup_)(shared_ptr_type);
-
+
         struct run_custom_cleanup_function
         {
             void (*cleanup_function_)(T*);
-
+
             explicit run_custom_cleanup_function(
- void (*cleanup_function)(shared_ptr_type)):
+ void (*cleanup_function)(shared_ptr_type)):
                 cleanup_function_(cleanup_function)
             {}
-
+
             void operator()(tss_type* ptr)
             {
                 if(cleanup_function_) {
- cleanup_function_(ptr->shptr_);
+ cleanup_function_(ptr->shptr_);
                 }
- ptr->type_.detach_from_current_thread();
+ ptr->type_.detach_from_current_thread();
                 delete ptr;
 
             }
         };
-
- void detach_from_current_thread() {
- lock_type lock(monitor_);
- tmap_.erase(boost::this_thread::get_id());
- }
-
- tss_type* create_if_not_exists() {
- tss_type* tss_ptr=tss_ptr_.get();
- if (tss_ptr==0) {
- tss_ptr = new tss_type(*this, cleanup_);
- tss_ptr_.reset(tss_ptr);
+
+ void detach_from_current_thread() {
+ lock_type lock(monitor_);
+ tmap_.erase(boost::this_thread::get_id());
+ }
+
+ tss_type* create_if_not_exists() {
+ tss_type* tss_ptr=tss_ptr_.get();
+ if (tss_ptr==0) {
+ tss_ptr = new tss_type(*this, cleanup_);
+ tss_ptr_.reset(tss_ptr);
             }
- return tss_ptr;
- }
+ return tss_ptr;
+ }
+
+ void update_map(tss_type* tss_ptr) {
+ // update the map
+ lock_type lock(monitor_);
+ tmap_[boost::this_thread::get_id()] = tss_ptr->shptr_;
+ // and notify the change
+ mapchanged_.notify_all();
+ }
 
- void update_map(tss_type* tss_ptr) {
- // update the map
- lock_type lock(monitor_);
- tmap_[boost::this_thread::get_id()] = tss_ptr->shptr_;
- // and notify the change
- mapchanged_.notify_all();
- }
-
     public:
- thread_specific_shared_ptr()
- : tss_ptr_(detach_and_delete_cleanup_function)
+ thread_specific_shared_ptr()
+ : tss_ptr_(detach_and_delete_cleanup_function)
         , cleanup_(0) {}
         explicit thread_specific_shared_ptr(void (*cleanup)(shared_ptr_type))
         : tss_ptr_(detach_and_delete_cleanup_function)
@@ -115,104 +115,104 @@
 
         static void detach_and_delete_cleanup_function(tss_type* ptr) {
             if (ptr->cleanup_!=0) (*(ptr->cleanup_))(ptr->shptr_);
- ptr->type_.detach_from_current_thread();
+ ptr->type_.detach_from_current_thread();
             delete ptr;
         }
-
+
         ~thread_specific_shared_ptr()
         {}
-
- T* get() const {
- tss_type* tss_ptr=tss_ptr_.get();
- if (tss_ptr==0) { return 0; }
- else { return tss_ptr->shptr_.get(); }
- }
-
- T* operator->() const {
+
+ T* get() const {
+ tss_type* tss_ptr=tss_ptr_.get();
+ if (tss_ptr==0) { return 0; }
+ else { return tss_ptr->shptr_.get(); }
+ }
+
+ T* operator->() const {
             return get();
- }
-
- T& operator*() const {
+ }
+
+ T& operator*() const {
             return *get();
- }
-#if 0
- shared_ptr_type release()
- {
- // get the tss
- tss_type* tss_ptr=tss_ptr_.get();
-
- if (tss_ptr==0) { return shared_ptr_type(); }
-
- // copy the shared pointer
- shared_ptr_type temp= tss_ptr->shptr_;
- // release the ptr
- tss_ptr->shptr_.release();
- {
- // erase from the map
- lock_type lock(monitor_);
- tmap_.erase(boost::this_thread::get_id());
- }
- // return the copied shared pointer
+ }
+#if 0
+ shared_ptr_type release()
+ {
+ // get the tss
+ tss_type* tss_ptr=tss_ptr_.get();
+
+ if (tss_ptr==0) { return shared_ptr_type(); }
+
+ // copy the shared pointer
+ shared_ptr_type temp= tss_ptr->shptr_;
+ // release the ptr
+ tss_ptr->shptr_.release();
+ {
+ // erase from the map
+ lock_type lock(monitor_);
+ tmap_.erase(boost::this_thread::get_id());
+ }
+ // return the copied shared pointer
             return temp;
         }
-#endif
+#endif
         void reset()
         {
- tss_type* tss_ptr=create_if_not_exists();
- tss_ptr->shptr_.reset();
- update_map(tss_ptr);
+ tss_type* tss_ptr=create_if_not_exists();
+ tss_ptr->shptr_.reset();
+ update_map(tss_ptr);
         }
 
         template<class Y> void reset(Y * p)
         {
- tss_type* tss_ptr=create_if_not_exists();
- tss_ptr->shptr_.reset(p);
- update_map(tss_ptr);
+ tss_type* tss_ptr=create_if_not_exists();
+ tss_ptr->shptr_.reset(p);
+ update_map(tss_ptr);
         }
 
         template<class Y, class D> void reset(Y * p, D d)
         {
- tss_type* tss_ptr=create_if_not_exists();
- tss_ptr->shptr_.reset(p, d);
- update_map(tss_ptr);
+ tss_type* tss_ptr=create_if_not_exists();
+ tss_ptr->shptr_.reset(p, d);
+ update_map(tss_ptr);
         }
 
         template<class Y, class D, class A> void reset(Y * p, D d, A a)
         {
- tss_type* tss_ptr=create_if_not_exists();
- tss_ptr->shptr_.reset(p, d, a);
- update_map(tss_ptr);
+ tss_type* tss_ptr=create_if_not_exists();
+ tss_ptr->shptr_.reset(p, d, a);
+ update_map(tss_ptr);
         }
 
 // template<class Y> void reset(shared_ptr<Y> const & r, T * p)
-
+
 
         shared_ptr_type wait_and_get(thread::id id) const {
- lock_type lock(monitor_);
- typename map_type::const_iterator i;
- while ((i = tmap_.find(id)) == tmap_.end())
- mapchanged_.wait(lock);
- return i->second;
- }
+ lock_type lock(monitor_);
+ typename map_type::const_iterator i;
+ while ((i = tmap_.find(id)) == tmap_.end())
+ mapchanged_.wait(lock);
+ return i->second;
+ }
 
         shared_ptr_type operator[](thread::id id) const {
- lock_type lock(monitor_);
- typename map_type::const_iterator i(tmap_.find(id));
- if ( i == tmap_.end()) {
+ lock_type lock(monitor_);
+ typename map_type::const_iterator i(tmap_.find(id));
+ if ( i == tmap_.end()) {
                 mapchanged_.wait(lock);
 
- return shared_ptr_type();
- } else {
- return i->second;
- }
- }
-
- mutex_type& get_mutex() {return monitor_;}
-
- const map_type& get_map(lock_type& lock) {
- return tmap_;
- }
-
+ return shared_ptr_type();
+ } else {
+ return i->second;
+ }
+ }
+
+ mutex_type& get_mutex() {return monitor_;}
+
+ const map_type& get_map(lock_type& lock) {
+ return tmap_;
+ }
+
     };
 }
 }

Modified: sandbox/interthreads/boost/interthreads/thread_tuple.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/thread_tuple.hpp (original)
+++ sandbox/interthreads/boost/interthreads/thread_tuple.hpp 2009-02-08 16:30:25 EST (Sun, 08 Feb 2009)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Vicente J. Botet Escriba 2008-20009. Distributed under the Boost
+// (C) Copyright Vicente J. Botet Escriba 2008-2009. 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)
 //
@@ -32,73 +32,73 @@
 
     template <std::size_t N>
     class thread_tuple;
-
+
 namespace detail {
-
+
     template <std::size_t size_>
     class thread_tuple_storage_stack {
         typedef thread_tuple_storage_stack<size_> this_type;
     public:
         struct thread_tuple_data {
- array<thread, size_> threads_;
+ array<thread, size_> threads_;
         };
         thread_tuple_data data_;
         thread_tuple_data* data() {return &data_;}
         thread& threads(std::size_t i) {return data_.threads_[i];}
 
         // constructors/destructors
- inline thread_tuple_storage_stack()
- : data_()
+ inline thread_tuple_storage_stack()
+ : data_()
         {}
-
+
 #ifdef BOOST_HAS_RVALUE_REFS
- thread_tuple_storage_stack(this_type&& other)
+ thread_tuple_storage_stack(this_type&& other)
             : data_()
         {
- for (std::size_t i=0; i<size_; i++) {
- threads(i) = boost::move(other.data_.threads(i));
- }
+ for (std::size_t i=0; i<size_; i++) {
+ threads(i) = boost::move(other.data_.threads(i));
+ }
         }
 
         this_type&& move() {
             return static_cast<this_type&&>(*this);
         }
-#else
+#else
 #ifdef BOOST_HAS_MOVE_LIB
- thread_tuple_storage_stack(move_from<this_type> other)
+ thread_tuple_storage_stack(move_from<this_type> other)
             : data_()
         {
- for (std::size_t i=0; i<size_; i++) {
- this->threads(i) = boost::move(other.data_.threads(i));
- }
+ for (std::size_t i=0; i<size_; i++) {
+ this->threads(i) = boost::move(other.data_.threads(i));
+ }
         }
 
         operator move_from<this_type>() {
             return move();
- }
+ }
 
         move_from<this_type> move() {
             return move_from<this_type>(*this);
- }
-#else
- thread_tuple_storage_stack(boost::detail::thread_move_t<this_type> other)
+ }
+#else
+ thread_tuple_storage_stack(boost::detail::thread_move_t<this_type> other)
             : data_()
         {
- for (std::size_t i=0; i<size_; i++) {
- this->threads(i) = boost::move(other.data_.threads(i));
- }
+ for (std::size_t i=0; i<size_; i++) {
+ this->threads(i) = boost::move(other.data_.threads(i));
+ }
         }
 
         operator boost::detail::thread_move_t<this_type>() {
             return move();
- }
+ }
 
         boost::detail::thread_move_t<this_type> move() {
             return boost::detail::thread_move_t<this_type>(*this);
- }
-#endif
-#endif
- inline ~thread_tuple_storage_stack() {
+ }
+#endif
+#endif
+ inline ~thread_tuple_storage_stack() {
         }
     };
 
@@ -107,18 +107,18 @@
         typedef thread_tuple_storage_heap<size_> this_type;
     public:
         struct thread_tuple_data {
- array<thread, size_> threads_;
+ array<thread, size_> threads_;
         };
         shared_ptr<thread_tuple_data> data_;
         thread_tuple_data* data() {return data_.get();}
         thread& threads(std::size_t i) {return data_->threads_[i];}
 
         // constructors/destructors
- inline thread_tuple_storage_heap()
+ inline thread_tuple_storage_heap()
             : data_(new thread_tuple_data())
         {}
 #ifdef BOOST_HAS_RVALUE_REFS
- thread_tuple_storage_heap(this_type&& other)
+ thread_tuple_storage_heap(this_type&& other)
             : data_(other->data_)
         {
             other->data_.reset();
@@ -127,8 +127,8 @@
         this_type&& move() {
             return static_cast<this_type&&>(*this);
         }
-#else
- thread_tuple_storage_heap(boost::detail::thread_move_t<this_type> other)
+#else
+ thread_tuple_storage_heap(boost::detail::thread_move_t<this_type> other)
             : data_(other->data_)
         {
             other->data_.reset();
@@ -149,18 +149,18 @@
         {
             data_.swap(x.data_);
         }
-
+
     };
-
+
     template <std::size_t size_, class STORAGE>
     class thread_tuple_base : protected STORAGE
     {
         typedef STORAGE base_type;
         typedef thread_tuple_base<size_, STORAGE> this_type;
-
+
     public:
         // constructors/destructors
- inline thread_tuple_base()
+ inline thread_tuple_base()
             : base_type()
         {}
 
@@ -173,53 +173,53 @@
         this_type&& move() {
             return static_cast<this_type&&>(*this);
         }
-#else
+#else
 #ifdef BOOST_HAS_MOVE_LIB
- thread_tuple_base(move_from<this_type> x)
+ thread_tuple_base(move_from<this_type> x)
             : base_type(boost::move(*(static_cast<base_type*>(&(x.member))))) {}
 
         operator move_from<this_type>() {
             return move();
- }
+ }
 
         move_from move() {
             return move_from<this_type>(*this);
- }
-#else
- thread_tuple_base(boost::detail::thread_move_t<this_type> x)
+ }
+#else
+ thread_tuple_base(boost::detail::thread_move_t<this_type> x)
             : base_type(boost::move(*(static_cast<base_type*>(&(x.t))))) {}
 
         operator boost::detail::thread_move_t<this_type>() {
             return move();
- }
+ }
 
         boost::detail::thread_move_t<this_type> move() {
             return boost::detail::thread_move_t<this_type>(*this);
- }
+ }
 #endif
 #endif
- inline ~thread_tuple_base() {
+ inline ~thread_tuple_base() {
             if (this->data()!=0) detach_all();
         }
 
         bool joinables() const {
- for (std::size_t i=0; i<size_; i++) {
- if (!this->threads(i).joinable()) return false;
- }
- return true;
+ for (std::size_t i=0; i<size_; i++) {
+ if (!this->threads(i).joinable()) return false;
+ }
+ return true;
         }
 
         void join_all() {
- for (std::size_t i=0; i<size_; i++) {
- this->threads(i).join();
- }
+ for (std::size_t i=0; i<size_; i++) {
+ this->threads(i).join();
+ }
         }
 
         bool join_all_until(const system_time& wait_until) {
- for (std::size_t i=0; i<size_; i++) {
- if (!this->threads(i).timed_join(wait_until)) return false;
- }
- return true;
+ for (std::size_t i=0; i<size_; i++) {
+ if (!this->threads(i).timed_join(wait_until)) return false;
+ }
+ return true;
         }
 
         template<typename TimeDuration>
@@ -229,41 +229,41 @@
         }
 
         void detach_all() {
- for (std::size_t i=0; i<size_; i++) {
- this->threads(i).detach();
- }
+ for (std::size_t i=0; i<size_; i++) {
+ this->threads(i).detach();
+ }
         }
-
+
         void interrupt_all() {
- for (std::size_t i=0; i<size_; i++) {
- this->threads(i).interrupt();
- }
+ for (std::size_t i=0; i<size_; i++) {
+ this->threads(i).interrupt();
+ }
         }
 
         bool interruption_requested() const {
- for (std::size_t i=0; i<size_; i++) {
- if (!this->threads(i).interruption_requested()) return false;
- }
- return true;
+ for (std::size_t i=0; i<size_; i++) {
+ if (!this->threads(i).interruption_requested()) return false;
+ }
+ return true;
         }
-
+
         inline std::size_t size() const { return size_; }
-
+
         inline thread& operator[](std::size_t i) const {
- return this->threads(i);
+ return this->threads(i);
         }
 
     private:
- thread_tuple_base(thread_tuple_base&);
+ thread_tuple_base(thread_tuple_base&);
         thread_tuple_base& operator=(thread_tuple_base&);
 // protected:
 // struct thread_tuple_data {
-// array<thread, size_> threads_;
+// array<thread, size_> threads_;
 // };
 // shared_ptr<thread_tuple_data> data_;
 // thread& threads(std::size_t i) {return data_->threads_[i];}
-
- };
+
+ };
 }
 
     template <>
@@ -271,13 +271,13 @@
         typedef detail::thread_tuple_base<2, detail::thread_tuple_storage_heap<2> > base_type;
         typedef thread_tuple<2> this_type;
     public:
- inline thread_tuple() {}
-
+ inline thread_tuple() {}
+
         template<typename F0, typename F1>
- inline thread_tuple(F0 f0, F1 f1) {
+ inline thread_tuple(F0 f0, F1 f1) {
             this->threads(0) = thread(f0);
- this->threads(1) = thread(f1);
- }
+ this->threads(1) = thread(f1);
+ }
 
         // move support
 #ifdef BOOST_HAS_RVALUE_REFS
@@ -295,7 +295,7 @@
         }
 #else
 #ifdef BOOST_HAS_MOVE_LIB
- thread_tuple(move_from<this_type> x)
+ thread_tuple(move_from<this_type> x)
             : base_type(boost::move(static_cast<base_type*>(&(x.member)))) {}
 
         this_type& operator=(this_type& rhs) {
@@ -312,13 +312,13 @@
 
         operator move_from<this_type>() {
             return move();
- }
+ }
 
         move_from<this_type> move() {
             return move_from<this_type>(*this);
- }
+ }
 #else
- thread_tuple(boost::detail::thread_move_t<this_type> x)
+ thread_tuple(boost::detail::thread_move_t<this_type> x)
             : base_type(boost::move(*(static_cast<base_type*>(&(x.t))))) {}
 
         this_type& operator=(this_type& rhs) {
@@ -335,30 +335,30 @@
 
         operator boost::detail::thread_move_t<this_type>() {
             return move();
- }
+ }
 
         boost::detail::thread_move_t<this_type> move() {
             return boost::detail::thread_move_t<this_type>(*this);
- }
+ }
 #endif
 #endif
-
+
         void swap(this_type& x) { base_type::swap(x); }
-
- };
+
+ };
 
     template <>
     class thread_tuple<3>: public detail::thread_tuple_base<3, detail::thread_tuple_storage_heap<3> > {
         typedef detail::thread_tuple_base<3, detail::thread_tuple_storage_heap<3> > base_type;
         typedef thread_tuple<3> this_type;
     public:
- thread_tuple() {}
+ thread_tuple() {}
         template<typename F0, typename F1, typename F2>
- inline thread_tuple(F0 f0, F1 f1, F2 f2)
+ inline thread_tuple(F0 f0, F1 f1, F2 f2)
             {
             this->threads(0) = thread(f0);
- this->threads(1) = thread(f1);
- this->threads(2) = thread(f2);
+ this->threads(1) = thread(f1);
+ this->threads(2) = thread(f2);
         }
         // move support
 #ifdef BOOST_HAS_RVALUE_REFS
@@ -374,12 +374,12 @@
         this_type&& move() {
             return static_cast<thread&&>(*this);
         }
-#else
+#else
         thread_tuple(boost::detail::thread_move_t<this_type> x) {
             data_=x->data_;
             x->data_.reset(new thread_tuple_data());
         }
-
+
         this_type& operator=(boost::detail::thread_move_t<this_type> x) {
             this_type new_thread_tuple(x);
             swap(new_thread_tuple);
@@ -388,32 +388,32 @@
 
         operator boost::detail::thread_move_t<this_type>() {
             return move();
- }
+ }
 
         boost::detail::thread_move_t<this_type> move() {
             return boost::detail::thread_move_t<this_type>(*this);
- }
-
-#endif
+ }
+
+#endif
         void swap(this_type& x)
         {
             data_.swap(x.data_);
         }
-
- };
+
+ };
 
     template<typename F0, typename F1>
     thread_tuple<2> make_thread_tuple(F0 f0, F1 f1) {
         return thread_tuple<2>(f0, f1);
     }
-
+
     template<typename F0, typename F1, typename F2>
     thread_tuple<3> make_thread_tuple(F0 f0, F1 f1, F2 f2) {
         return thread_tuple<3>(f0, f1, f2);
     }
-
 
-}
+
+}
 } // namespace boost
 
 #include <boost/config/abi_suffix.hpp>

Modified: sandbox/interthreads/boost/interthreads/thread_tuple_once.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/thread_tuple_once.hpp (original)
+++ sandbox/interthreads/boost/interthreads/thread_tuple_once.hpp 2009-02-08 16:30:25 EST (Sun, 08 Feb 2009)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Vicente J. Botet Escriba 2008-20009. Distributed under the Boost
+// (C) Copyright Vicente J. Botet Escriba 2008-2009. 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)
 //
@@ -23,39 +23,39 @@
 
     template <std::size_t N>
     class thread_tuple_once;
-
+
     template <std::size_t size_>
     class thread_tuple_once_base
     {
     public:
- inline thread_tuple_once_base()
+ inline thread_tuple_once_base()
             : data_(new thread_tuple_once_data())
         {}
- inline ~thread_tuple_once_base() {
+ inline ~thread_tuple_once_base() {
             detach_all();
         }
 
         bool joinable() const {
- for (std::size_t i=0; i<size_; i++) {
- if (!threads(i).joinable()) return false;
- }
- return true;
+ for (std::size_t i=0; i<size_; i++) {
+ if (!threads(i).joinable()) return false;
+ }
+ return true;
         }
 
         void join_all() {
- once().wait();
- for (std::size_t i=0; i<size_; i++) {
- threads(i).join();
- }
+ once().wait();
+ for (std::size_t i=0; i<size_; i++) {
+ threads(i).join();
+ }
         }
 
         bool join_all_until(const system_time& wait_until) {
- std::pair<bool,std::size_t> succeed = once().get_until(wait_until);
+ std::pair<bool,std::size_t> succeed = once().get_until(wait_until);
             if (!succeed.first) return false;
- for (std::size_t i=0; i<size_; i++) {
- if (!threads(i).timed_join(wait_until)) return false;
- }
- return true;
+ for (std::size_t i=0; i<size_; i++) {
+ if (!threads(i).timed_join(wait_until)) return false;
+ }
+ return true;
         }
 
         template<typename TimeDuration>
@@ -66,10 +66,10 @@
 
 
         std::size_t join_any() {
- return once().get();
+ return once().get();
         }
         std::pair<bool,std::size_t> join_any_until(const system_time& wait_until) {
- return once().get_until(wait_until);
+ return once().get_until(wait_until);
         }
 
         template<typename TimeDuration>
@@ -79,71 +79,71 @@
         }
 
         void detach_all() {
- for (std::size_t i=0; i<size_; i++) {
- threads(i).detach();
- }
+ for (std::size_t i=0; i<size_; i++) {
+ threads(i).detach();
+ }
         }
-
+
         void interrupt_all() {
- for (std::size_t i=0; i<size_; i++) {
- threads(i).interrupt();
- }
+ for (std::size_t i=0; i<size_; i++) {
+ threads(i).interrupt();
+ }
         }
 
         bool interruption_requested() const {
- for (std::size_t i=0; i<size_; i++) {
- if (threads(i).interruption_requested()) return true;
- }
- return false;
+ for (std::size_t i=0; i<size_; i++) {
+ if (threads(i).interruption_requested()) return true;
+ }
+ return false;
         }
-
+
         inline std::size_t size() const { return size_; }
-
+
         inline thread& operator[](std::size_t i) const {
- return *threads(i);
+ return *threads(i);
         }
 
     private:
- thread_tuple_once_base(thread_tuple_once_base&);
+ thread_tuple_once_base(thread_tuple_once_base&);
         thread_tuple_once_base& operator=(thread_tuple_once_base&);
     protected:
         typedef set_once<std::size_t> set_once_type;
 
         struct thread_tuple_once_data {
- set_once_type once_;
- thread threads_[size_];
+ set_once_type once_;
+ thread threads_[size_];
         };
         shared_ptr<thread_tuple_once_data> data_;
         set_once_type& once() { return data_->once_; }
         thread& threads(std::size_t i) {return data_->threads_[i];}
-
- };
-
+
+ };
+
     template <>
     class thread_tuple_once<2>: public thread_tuple_once_base<2> {
         typedef thread_tuple_once_base<2> base_type;
     public:
         template<typename F0, typename F1>
- inline thread_tuple_once(F0 f0, F1 f1) {
+ inline thread_tuple_once(F0 f0, F1 f1) {
             data_->threads_[0] = base_type::set_once_type::make_thread(once(), 0, f0);
- data_->threads_[1] = base_type::set_once_type::make_thread(once(), 1, f1);
- }
- };
+ data_->threads_[1] = base_type::set_once_type::make_thread(once(), 1, f1);
+ }
+ };
 
     template <>
     class thread_tuple_once<3>: public thread_tuple_once_base<3> {
         typedef thread_tuple_once_base<3> base_type;
     public:
         template<typename F0, typename F1, typename F2>
- inline thread_tuple_once(F0 f0, F1 f1, F2 f2) {
+ inline thread_tuple_once(F0 f0, F1 f1, F2 f2) {
             data_->threads_[0] = base_type::set_once_type::make_thread(once(), 0, f0);
- data_->threads_[1] = base_type::set_once_type::make_thread(once(), 1, f1);
- data_->threads_[2] = base_type::set_once_type::make_thread(once(), 2, f2);
- }
- };
+ data_->threads_[1] = base_type::set_once_type::make_thread(once(), 1, f1);
+ data_->threads_[2] = base_type::set_once_type::make_thread(once(), 2, f2);
+ }
+ };
 
 
-}
+}
 } // namespace boost
 
 #include <boost/config/abi_suffix.hpp>

Modified: sandbox/interthreads/boost/interthreads/threader.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/threader.hpp (original)
+++ sandbox/interthreads/boost/interthreads/threader.hpp 2009-02-08 16:30:25 EST (Sun, 08 Feb 2009)
@@ -3,9 +3,9 @@
 
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Vicente J. Botet Escriba 2008-20009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// (C) Copyright Vicente J. Botet Escriba 2008-2009.
+// 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)
 //
 // Based on the unique_threader/unique_joiner design from of Kevlin Henney (n1883)
@@ -38,7 +38,8 @@
 
 template<typename T>
 struct act_traits<unique_joiner<T> > : act_traits<unique_future<T> > {};
-
+
+
 template <typename ResultType>
 class unique_joiner {
 public:
@@ -50,9 +51,12 @@
         thread th_;
 
         unique_joiner_data() {}
-
- template <typename Nullary>
-#ifdef BOOST_THREAD_HAS_THREAD_ATTR
+ ~unique_joiner_data() {
+ //if (th_.joinable()) th_.join();
+ }
+
+ template <typename Nullary>
+#ifdef BOOST_THREAD_HAS_THREAD_ATTR
         unique_joiner_data(thread::native_handle_attr_type& attr, Nullary f) {
             packaged_task<result_type> tsk(f);
             fut_ = tsk.get_future();
@@ -63,14 +67,14 @@
         unique_joiner_data(Nullary f) {
             packaged_task<result_type> tsk(f);
             fut_ = tsk.get_future();
-#if 0
+#if 0
             th_ = boost::move(tsk);
-#else
+#else
             thread th(boost::move(tsk));
             th_ = boost::move(th);
-#endif
+#endif
         }
-#endif
+#endif
 
     };
     shared_ptr<unique_joiner_data> data_;
@@ -82,16 +86,18 @@
 //protected:
 public:
     friend class unique_threader;
- template <typename Nullary>
+
+ template <typename Nullary>
     // requires result_of<Nullary>::type is convertible to ResultType
-#ifdef BOOST_THREAD_HAS_THREAD_ATTR
- unique_joiner(thread::native_handle_attr_type& attr, Nullary f)
+#ifdef BOOST_THREAD_HAS_THREAD_ATTR
+ unique_joiner(thread::native_handle_attr_type& attr, Nullary f)
     : data_(new this_impl_type(attr, f))
 #else
- unique_joiner(Nullary f)
+ unique_joiner(Nullary f)
     : data_(new this_impl_type(f))
-#endif
- {}
+#endif
+ {}
+
 
 public:
     // move support
@@ -108,12 +114,12 @@
     unique_joiner&& move() {
         return static_cast<unique_joiner&&>(*this);
     }
-#else
+#else
     unique_joiner(boost::detail::thread_move_t<unique_joiner> x) {
         data_=x->data_;
         x->data_.reset(new this_impl_type());
     }
-
+
     unique_joiner& operator=(boost::detail::thread_move_t<unique_joiner> x) {
         this_type tmp_(x);
         swap(tmp_);
@@ -122,28 +128,28 @@
 
     operator boost::detail::thread_move_t<unique_joiner>() {
         return move();
- }
+ }
 
     boost::detail::thread_move_t<unique_joiner> move() {
         return boost::detail::thread_move_t<unique_joiner>(*this);
- }
-
-#endif
-
+ }
+
+#endif
+
     void swap(this_type& x) {
         data_.swap(x.data_);
     }
 
- bool joinable() {
- return data_->th_.joinable();
+ bool joinable() {
+ return data_->th_.joinable();
     }
-
- void join() {
- data_->th_.join();
+
+ void join() {
+ data_->th_.join();
     }
 
     bool join_until(const system_time& abs_time) {
- return data_->th_.timed_join(abs_time);
+ return data_->th_.timed_join(abs_time);
     }
 
     template<typename TimeDuration>
@@ -151,26 +157,26 @@
     {
         return join_until(get_system_time()+rel_time);
     }
- move_dest_type get() {
- return data_->fut_.get();
+ move_dest_type get() {
+ return data_->fut_.get();
     }
     move_dest_type operator()() { return get(); }
 
     bool is_ready() const {
- return data_->fut_.is_ready();
+ return data_->fut_.is_ready();
     }
     bool has_exception() const {
- return data_->fut_.has_exception();
+ return data_->fut_.has_exception();
     }
     bool has_value() const {
- return data_->fut_.has_value();
+ return data_->fut_.has_value();
     }
 
     void wait() {
- data_->fut_.wait();
+ data_->fut_.wait();
     }
     bool wait_until(const system_time& abs_time) {
- return data_->fut_.timed_wait_until(abs_time);
+ return data_->fut_.timed_wait_until(abs_time);
     }
 
     template<typename TimeDuration>
@@ -180,23 +186,23 @@
     }
 
     void detach() {
- data_->th_.detach();
+ data_->th_.detach();
     }
-
+
     void interrupt() {
- data_->th_.interrupt();
+ data_->th_.interrupt();
     }
 
     bool interruption_requested() const {
- return data_->th_.interruption_requested();
+ return data_->th_.interruption_requested();
     }
-
+
     thread::id get_id() const {
- return data_->th_.get_id();
+ return data_->th_.get_id();
     }
-
+
     unique_future<result_type>& get_future() {
- return data_->fut_;
+ return data_->fut_;
     }
 };
 
@@ -208,39 +214,39 @@
 
 template <typename R>
 struct has_thread_if<unique_joiner<R> > : mpl::true_{};
-
+
 class unique_threader {
-#ifdef BOOST_THREAD_HAS_THREAD_ATTR
-private:
+#ifdef BOOST_THREAD_HAS_THREAD_ATTR
+private:
     thread_specific_ptr<thread::native_handle_attr_type> attr_;
-public:
+public:
     thread::native_handle_attr_type& attr() {
         if(attr_.get() ==0) {
             attr_.reset(new thread::native_handle_attr_type());
         };
         return *attr_.get();
     }
-#endif
+#endif
 
-public:
+public:
     template <typename T>
     struct handle {
         typedef unique_joiner<T> type;
     };
     template <typename F>
- unique_joiner<typename boost::result_of<F()>::type>
+ unique_joiner<typename boost::result_of<F()>::type>
     fork(F f) {
         typedef typename boost::result_of<F()>::type result_type;
-#ifdef BOOST_THREAD_HAS_THREAD_ATTR
+#ifdef BOOST_THREAD_HAS_THREAD_ATTR
         unique_joiner<result_type> unique_joiner_(attr(), f);
 #else
         unique_joiner<result_type> unique_joiner_(f);
-#endif
- return boost::move(unique_joiner_);
+#endif
+ return boost::move(unique_joiner_);
     }
 
 };
-
+
 template <>
 struct get_future<unique_threader> {
     template <typename T>
@@ -250,7 +256,7 @@
     template <typename T>
     unique_future<T>& operator()(unique_joiner<T>& j) { return j.get_future(); }
 };
-
+
 template <typename ResultType>
 class shared_joiner;
 
@@ -269,9 +275,9 @@
         thread th_;
 
         shared_joiner_data() {}
-
- template <typename Nullary>
-#ifdef BOOST_THREAD_HAS_THREAD_ATTR
+
+ template <typename Nullary>
+#ifdef BOOST_THREAD_HAS_THREAD_ATTR
         shared_joiner_data(thread::native_handle_attr_type& attr, Nullary f) {
             packaged_task<result_type> tsk(f);
             fut_ = tsk.get_future();
@@ -282,14 +288,14 @@
         shared_joiner_data(Nullary f) {
             packaged_task<result_type> tsk(f);
             fut_ = tsk.get_future();
-#if 0
+#if 0
             th_ = boost::move(tsk);
-#else
+#else
             thread th(boost::move(tsk));
             th_ = boost::move(th);
-#endif
+#endif
         }
-#endif
+#endif
 
     };
     shared_ptr<shared_joiner_data> data_;
@@ -299,17 +305,18 @@
 //protected:
 public:
     friend class shared_threader;
- template <typename Nullary>
+ template <typename Nullary>
     // requires result_of<Nullary>::type is convertible to ResultType
-#ifdef BOOST_THREAD_HAS_THREAD_ATTR
- shared_joiner(thread::native_handle_attr_type& attr, Nullary f)
+#ifdef BOOST_THREAD_HAS_THREAD_ATTR
+ shared_joiner(thread::native_handle_attr_type& attr, Nullary f)
     : data_(new this_impl_type(attr, f))
 #else
- shared_joiner(Nullary f)
+ shared_joiner(Nullary f)
     : data_(new this_impl_type(f))
-#endif
+#endif
     {
- }
+ }
+
 
 public:
     shared_joiner() : data_() {};
@@ -334,12 +341,12 @@
     shared_joiner&& move() {
         return static_cast<shared_joiner&&>(*this);
     }
-#else
+#else
     shared_joiner(boost::detail::thread_move_t<shared_joiner> x) {
         data_=x->data_;
         x->data_.reset(new this_impl_type());
     }
-
+
     shared_joiner& operator=(boost::detail::thread_move_t<shared_joiner> x) {
         this_type tmp_(x);
         swap(tmp_);
@@ -348,28 +355,28 @@
 
     operator boost::detail::thread_move_t<shared_joiner>() {
         return move();
- }
+ }
 
     boost::detail::thread_move_t<shared_joiner> move() {
         return boost::detail::thread_move_t<shared_joiner>(*this);
- }
-
-#endif
-
+ }
+
+#endif
+
     void swap(this_type& x) {
         data_.swap(x.data_);
     }
 
- bool joinable() {
- return data_->th_.joinable();
+ bool joinable() {
+ return data_->th_.joinable();
     }
-
- void join() {
- data_->th_.join();
+
+ void join() {
+ data_->th_.join();
     }
 
     bool join_until(const system_time& abs_time) {
- return data_->th_.timed_join(abs_time);
+ return data_->th_.timed_join(abs_time);
     }
 
     template<typename TimeDuration>
@@ -377,27 +384,27 @@
     {
         return join_until(get_system_time()+rel_time);
     }
- move_dest_type get() const {
- return data_->fut_.get();
+ move_dest_type get() const {
+ return data_->fut_.get();
     }
-
+
     move_dest_type operator()() const { return get(); }
 
     bool is_ready() const {
- return data_->fut_.is_ready();
+ return data_->fut_.is_ready();
     }
     bool has_exception() const {
- return data_->fut_.has_exception();
+ return data_->fut_.has_exception();
     }
     bool has_value() const {
- return data_->fut_.has_value();
+ return data_->fut_.has_value();
     }
 
     void wait() {
- data_->fut_.wait();
+ data_->fut_.wait();
     }
     bool wait_until(const system_time& abs_time) {
- return data_->fut_.timed_wait_until(abs_time);
+ return data_->fut_.timed_wait_until(abs_time);
     }
 
     template<typename TimeDuration>
@@ -407,23 +414,23 @@
     }
 
     void detach() {
- data_->th_.detach();
+ data_->th_.detach();
     }
-
+
     void interrupt() {
- data_->th_.interrupt();
+ data_->th_.interrupt();
     }
 
     bool interruption_requested() const {
- return data_->th_.interruption_requested();
+ return data_->th_.interruption_requested();
     }
-
+
     thread::id get_id() const {
- return data_->th_.get_id();
+ return data_->th_.get_id();
     }
-
+
     shared_future<result_type>& get_future() {
- return data_->fut_;
+ return data_->fut_;
     }
 };
 
@@ -438,36 +445,38 @@
 
 
 class shared_threader {
-#ifdef BOOST_THREAD_HAS_THREAD_ATTR
-private:
+#ifdef BOOST_THREAD_HAS_THREAD_ATTR
+private:
     thread_specific_ptr<thread::native_handle_attr_type> attr_;
-public:
+public:
     thread::native_handle_attr_type& attr() {
         if(attr_.get() ==0) {
             attr_.reset(new thread::native_handle_attr_type());
         };
         return *attr_.get();
     }
-#endif
+#endif
 
-public:
+public:
     template <typename T>
     struct handle {
         typedef shared_joiner<T> type;
     };
     template <typename F>
- shared_joiner<typename boost::result_of<F()>::type>
+ shared_joiner<typename boost::result_of<F()>::type>
     fork(F f) {
         typedef typename boost::result_of<F()>::type result_type;
-#ifdef BOOST_THREAD_HAS_THREAD_ATTR
+#ifdef BOOST_THREAD_HAS_THREAD_ATTR
         return shared_joiner<result_type>(attr(), f);
 #else
         return shared_joiner<result_type>(f);
-#endif
+#endif
     }
 
+
+
 };
-
+
 template <>
 struct get_future<shared_threader> {
     template <typename T>
@@ -501,7 +510,7 @@
     }
 #else
     template <typename T>
- inline boost::detail::thread_move_t<interthreads::shared_joiner<T> >
+ inline boost::detail::thread_move_t<interthreads::shared_joiner<T> >
     move(boost::interthreads::shared_joiner<T>& t)
     {
         return boost::detail::thread_move_t<interthreads::shared_joiner<T> >(t);

Modified: sandbox/interthreads/boost/interthreads/threader_decorator.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/threader_decorator.hpp (original)
+++ sandbox/interthreads/boost/interthreads/threader_decorator.hpp 2009-02-08 16:30:25 EST (Sun, 08 Feb 2009)
@@ -3,10 +3,10 @@
 
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Roland Schwarz 2006.
-// (C) Copyright Vicente J. Botet Escriba 2008-20009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// (C) Copyright Roland Schwarz 2006.
+// (C) Copyright Vicente J. Botet Escriba 2008-2009.
+// 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)
 //
 // Extension of the init class of the threadalert library of Roland Schwarz
@@ -24,11 +24,11 @@
 
 namespace boost {
 namespace interthreads {
-
+
 
     typedef asynchronous_executor_decorator<unique_threader,basic_thread_decorator> unique_threader_decorator;
     typedef asynchronous_executor_decorator<shared_threader,basic_thread_decorator> shared_threader_decorator;
-
+
 }
 }
 

Modified: sandbox/interthreads/boost/interthreads/wait_for_all.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/wait_for_all.hpp (original)
+++ sandbox/interthreads/boost/interthreads/wait_for_all.hpp 2009-02-08 16:30:25 EST (Sun, 08 Feb 2009)
@@ -3,9 +3,9 @@
 
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Vicente J. Botet Escriba 2008-20009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// (C) Copyright Vicente J. Botet Escriba 2008-2009.
+// 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)
 //
 // Based on the threader/joiner design from of Kevlin Henney (n1883)
@@ -26,7 +26,7 @@
 namespace boost {
 namespace interthreads {
 
-namespace result_of {
+namespace result_of {
     template <typename L, typename T>
     struct wait_for_all;
     template <typename L, typename F1>
@@ -50,34 +50,66 @@
             typename boost::result_of<F3()>::type
> type;
     };
-
+
 }
 
-template< typename AE, typename F1>
+template< typename AE, typename F1>
 typename result_of::wait_for_all<AE, fusion::tuple<F1> >::type
 wait_for_all( AE& ae, F1 f1 ) {
+ #if 1
     typename result_of::fork_all<AE, fusion::tuple<F1> >::type handles(fork_all(ae, f1));
     typename result_of::wait_for_all<AE, fusion::tuple<F1> >::type values;
     set_all(handles,values);
     return values;
+ #else
+ //typename boost::result_of<F1()>::type = f1();
+ return typename result_of::wait_for_all<AE, fusion::tuple<F1> >::type(f1());
+ #endif
 }
 
-template< typename AE, typename F1, typename F2>
+template< typename AE, typename F1, typename F2>
 typename result_of::wait_for_all<AE, fusion::tuple<F1,F2> >::type
 wait_for_all( AE& ae, F1 f1, F2 f2 ) {
+ #if 1
     typename result_of::fork_all<AE, fusion::tuple<F1,F2> >::type handles(fork_all(ae, f1, f2));
     typename result_of::wait_for_all<AE, fusion::tuple<F1,F2> >::type values;
     set_all(handles,values);
     return values;
+ #else
+ typename result_of::fork_all<AE, fusion::tuple<F1> >::type handles(fork_all(ae, f1));
+ typename result_of::wait_for_all<AE, fusion::tuple<F1> >::type values;
+ set_all(handles,values);
+ return typename result_of::wait_for_all<AE, fusion::tuple<F1,F2> >::type(
+ fusion::at_c<0>(values), f2());
+ #endif
 }
 
-template< typename AE, typename F1, typename F2, typename F3>
+#if 0
+template< typename AE, typename F, typename Sequence>
+typename result_of::wait_for_all<AE, fusion::tuple<F1,F2> >::type
+wait_for_all( AE& ae, F f, const Sequence& seq ) {
+ typename result_of::fork_all_seq<AE, F, Sequence>::type handles(fork_all(ae, f, seq));
+ typename result_of::wait_for_all_seq<AE, F, Sequence> >::type values;
+ set_all(handles,values);
+ return values;
+}
+#endif
+
+template< typename AE, typename F1, typename F2, typename F3>
 typename result_of::wait_for_all<AE, fusion::tuple<F1,F2,F3> >::type
 wait_for_all( AE& ae, F1 f1, F2 f2 , F3 f3 ) {
+ #if 1
     typename result_of::fork_all<AE, fusion::tuple<F1,F2,F3> >::type handles(fork_all(ae, f1, f2, f3));
     typename result_of::wait_for_all<AE, fusion::tuple<F1,F2,F3> >::type values;
     set_all(handles,values);
     return values;
+ #else
+ typename result_of::fork_all<AE, fusion::tuple<F1, F2> >::type handles(fork_all(ae, f1, f2));
+ typename result_of::wait_for_all<AE, fusion::tuple<F1, F2> >::type values;
+ set_all(handles,values);
+ return typename result_of::wait_for_all<AE, fusion::tuple<F1,F2, F3> >::type(
+ fusion::at_c<0>(values), fusion::at_c<1>(values), f3());
+ #endif
 }
 
 }

Modified: sandbox/interthreads/boost/interthreads/wait_for_any.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/wait_for_any.hpp (original)
+++ sandbox/interthreads/boost/interthreads/wait_for_any.hpp 2009-02-08 16:30:25 EST (Sun, 08 Feb 2009)
@@ -3,9 +3,9 @@
 
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Vicente J. Botet Escriba 2008-20009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// (C) Copyright Vicente J. Botet Escriba 2008-2009.
+// 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)
 //
 // See http://www.boost.org/libs/interthreads for documentation.
@@ -13,6 +13,7 @@
 //////////////////////////////////////////////////////////////////////////////
 
 #include <boost/interthreads/algorithm/interrupt_all.hpp>
+#include <boost/interthreads/algorithm/wait_all.hpp>
 #include <boost/interthreads/fork_all.hpp>
 #include <boost/fusion/include/tuple.hpp>
 #include <boost/futures/future.hpp>
@@ -26,7 +27,7 @@
 namespace interthreads {
 
 namespace detail {
-
+
     template <typename T>
     struct pair_void {
         typedef std::pair<unsigned,T> type;
@@ -38,9 +39,9 @@
         typedef void value_type;
     };
 
- template <unsigned size, typename T>
+ template <unsigned size, typename T>
     struct partial;
- template <typename P>
+ template <typename P>
     struct partial<2,P> {
         typedef typename pair_void<P>::value_type T;
         typedef typename pair_void<P>::type type;
@@ -60,7 +61,7 @@
             }
         }
     };
- template <typename P>
+ template <typename P>
     struct partial<3,P> {
         typedef typename pair_void<P>::value_type T;
         typedef typename pair_void<P>::type type;
@@ -82,7 +83,7 @@
             }
         }
     };
-
+
     struct partial_aux {
         typedef pair_void<void>::value_type T;
         typedef pair_void<void>::type type;
@@ -92,15 +93,15 @@
             return std::make_pair(i,i);
         }
     };
-
- template <>
+
+ template <>
     struct partial<2, void > : partial_aux{};
-
- template <>
+
+ template <>
     struct partial<3, void > : partial_aux{};
-}
-
-namespace result_of {
+}
+
+namespace result_of {
     template <typename L, typename T>
     struct wait_for_any;
     template <typename L, typename F1, typename F2>
@@ -111,51 +112,54 @@
     struct wait_for_any<L, fusion::tuple<F1,F2,F3> > {
         typedef typename detail::pair_void<typename boost::result_of<F1()>::type>::type type;
     };
-
+
 }
 
 
-template< typename AE, typename F1, typename F2>
+template< typename AE, typename F1, typename F2>
 typename result_of::wait_for_any<AE, fusion::tuple<F1,F2> >::type
 wait_for_any( AE& ae, F1 f1, F2 f2 ) {
     typename result_of::fork_all<AE, fusion::tuple<F1,F2> >::type handles=fork_all(ae, f1, f2);
     unsigned r = boost::wait_for_any(get_future<AE>()(fusion::at_c<0>(handles)), get_future<AE>()(fusion::at_c<1>(handles)));
- std::cout << "boost::wait_for_any=" << r << std::endl;
- typename result_of::wait_for_any<AE, fusion::tuple<F1,F2> >::type res =
+ //std::cout << "boost::wait_for_any=" << r << std::endl;
+ typename result_of::wait_for_any<AE, fusion::tuple<F1,F2> >::type res =
         detail::partial<2,typename boost::result_of<F1()>::type >::make(r,handles);
-
+ //interrupt_all(handles);
+ //wait_all(handles);
+
     return res;
 }
 
-template< typename AE, typename F1, typename F2, typename F3>
+template< typename AE, typename F1, typename F2, typename F3>
 typename result_of::wait_for_any<AE, fusion::tuple<F1,F2,F3> >::type
 wait_for_any( AE& ae, F1 f1, F2 f2 , F3 f3 ) {
     typename result_of::fork_all<AE, fusion::tuple<F1,F2,F3> >::type handles=fork_all(ae, f1, f2, f3);
     unsigned r = boost::wait_for_any(get_future<AE>()(fusion::at_c<0>(handles)), get_future<AE>()(fusion::at_c<1>(handles)), get_future<AE>()(fusion::at_c<2>(handles)));
- typename result_of::wait_for_any<AE, fusion::tuple<F1,F2,F3> >::type res =
+ typename result_of::wait_for_any<AE, fusion::tuple<F1,F2,F3> >::type res =
         detail::partial<3, typename boost::result_of<F1()>::type >::make(r,handles);
+ //interrupt_all(handles);
     return res;
 }
 
-template< typename AE, typename F1, typename F2>
+template< typename AE, typename F1, typename F2>
 typename result_of::wait_for_any<AE, fusion::tuple<F1,F2> >::type
 wait_for_any_and_interrupt( AE& ae, F1 f1, F2 f2 ) {
     typename result_of::fork_all<AE, fusion::tuple<F1,F2> >::type handles=fork_all(ae, f1, f2);
     unsigned r = boost::wait_for_any(get_future<AE>()(fusion::at_c<0>(handles)), get_future<AE>()(fusion::at_c<1>(handles)));
     std::cout << "boost::wait_for_any=" << r << std::endl;
- typename result_of::wait_for_any<AE, fusion::tuple<F1,F2> >::type res =
+ typename result_of::wait_for_any<AE, fusion::tuple<F1,F2> >::type res =
         detail::partial<2,typename boost::result_of<F1()>::type >::make(r,handles);
-
+
     interrupt_all(handles);
     return res;
 }
 
-template< typename AE, typename F1, typename F2, typename F3>
+template< typename AE, typename F1, typename F2, typename F3>
 typename result_of::wait_for_any<AE, fusion::tuple<F1,F2,F3> >::type
 wait_for_any_and_interrupt( AE& ae, F1 f1, F2 f2 , F3 f3 ) {
     typename result_of::fork_all<AE, fusion::tuple<F1,F2,F3> >::type handles=fork_all(ae, f1, f2, f3);
     unsigned r = boost::wait_for_any(get_future<AE>()(fusion::at_c<0>(handles)), get_future<AE>()(fusion::at_c<1>(handles)), get_future<AE>()(fusion::at_c<2>(handles)));
- typename result_of::wait_for_any<AE, fusion::tuple<F1,F2,F3> >::type res =
+ typename result_of::wait_for_any<AE, fusion::tuple<F1,F2,F3> >::type res =
         detail::partial<3, typename boost::result_of<F1()>::type >::make(r,handles);
     interrupt_all(handles);
     return res;


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