|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r50762 - in sandbox/interthreads/boost/interthreads: . typeof
From: vicente.botet_at_[hidden]
Date: 2009-01-25 07:48:13
Author: viboes
Date: 2009-01-25 07:48:12 EST (Sun, 25 Jan 2009)
New Revision: 50762
URL: http://svn.boost.org/trac/boost/changeset/50762
Log:
interthreads version 0.3.1
Most bug fixed
Added:
sandbox/interthreads/boost/interthreads/future_traits.hpp (contents, props changed)
Text files modified:
sandbox/interthreads/boost/interthreads/act_traits.hpp | 46 ++++++-----
sandbox/interthreads/boost/interthreads/basic_threader.hpp | 11 +-
sandbox/interthreads/boost/interthreads/fork_after.hpp | 104 ++++++++++++++++----------
sandbox/interthreads/boost/interthreads/launcher.hpp | 155 +++++++++++++++++++++++++++++++++++++--
sandbox/interthreads/boost/interthreads/scheduler.hpp | 18 +++
sandbox/interthreads/boost/interthreads/threader.hpp | 44 ++++-------
sandbox/interthreads/boost/interthreads/typeof/launcher.hpp | 2
sandbox/interthreads/boost/interthreads/typeof/scheduler.hpp | 2
sandbox/interthreads/boost/interthreads/wait_for_any.hpp | 13 ---
9 files changed, 272 insertions(+), 123 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-01-25 07:48:12 EST (Sun, 25 Jan 2009)
@@ -18,6 +18,10 @@
#include <boost/utility/result_of.hpp>
#include <boost/futures/future.hpp>
#include <boost/mpl/bool.hpp>
+#include <boost/type_traits/is_fundamental.hpp>
+#include <boost/type_traits/is_convertible.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/thread/detail/move.hpp>
#include <boost/config/abi_prefix.hpp>
@@ -25,30 +29,30 @@
namespace boost {
namespace interthreads {
-template <typename ACT>
-struct act_value;
-
-template <typename ACT>
-struct is_movable : mpl::false_{};
+ template<typename ACT>
+ struct act_traits;
+
+ template <typename ACT>
+ struct is_movable : mpl::false_{};
-template <typename ACT>
-struct has_future_if : mpl::false_{};
+ template <typename ACT>
+ struct has_future_if : mpl::false_{};
-template <typename ACT>
-struct has_thread_if : mpl::false_{};
-
-template <typename AE, typename T>
-struct asynchronous_completion_token {
- typedef typename AE::template handle<T>::type type;
-};
+ template <typename ACT>
+ struct has_thread_if : mpl::false_{};
-
-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(); }
-};
-
+ 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();
+ }
+ };
}
}
Modified: sandbox/interthreads/boost/interthreads/basic_threader.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/basic_threader.hpp (original)
+++ sandbox/interthreads/boost/interthreads/basic_threader.hpp 2009-01-25 07:48:12 EST (Sun, 25 Jan 2009)
@@ -16,7 +16,6 @@
#include <boost/thread/detail/move.hpp>
#include <boost/thread/thread.hpp>
-//#include <boost/thread/tss.hpp>
#include <boost/interthreads/fork.hpp>
@@ -55,10 +54,12 @@
}
};
-template <>
-struct act_value<thread> {
- typedef void type;
-};
+ template<>
+ struct act_traits<thread > {
+ typedef void move_dest_type;
+ };
+
+
}
}
Modified: sandbox/interthreads/boost/interthreads/fork_after.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/fork_after.hpp (original)
+++ sandbox/interthreads/boost/interthreads/fork_after.hpp 2009-01-25 07:48:12 EST (Sun, 25 Jan 2009)
@@ -34,9 +34,16 @@
#define ACT_WRAPPER
#ifdef ACT_WRAPPER
+template <typename ACT>
+struct act_wrapper;
+
+template <typename ACT>
+struct act_traits<act_wrapper<ACT> > : act_traits<ACT>{};
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_) {
@@ -44,12 +51,27 @@
ptr_->cv_.wait(lk);
}
}
+ void set_initialized() {
+ unique_lock<mutex> lk(ptr_->mtx_);
+ ptr_->inittialized_=true;
+ }
+ void set(ACT& other) {
+ ptr_->act_=boost::move(other);
+ set_initialized();
+ ptr_->cv_.notify_all();
+ }
+ void set(boost::detail::thread_move_t<ACT> other) {
+ ptr_->act_=other;
+ set_initialized();
+ ptr_->cv_.notify_all();
+ }
+
void wait() {
wait_initialized();
ptr_->act_.wait();
}
- typename act_value<ACT>::type get() {
+ move_dest_type get() {
wait_initialized();
return ptr_->act_.get();
}
@@ -58,11 +80,6 @@
wait_initialized();
ptr_->act_.join();
}
- void set_initialized(ACT& other) {
- ptr_->act_=boost::move(other);
- ptr_->inittialized_=true;
- ptr_->cv_.notify_all();
- }
private:
struct data {
data()
@@ -76,10 +93,6 @@
shared_ptr<data> ptr_;
};
-template <typename ACT>
-struct act_value<act_wrapper<ACT> > {
- typedef typename act_value<ACT>::type type;
-};
template <typename ACT>
struct is_movable<act_wrapper<ACT> > : is_movable<ACT>{};
@@ -112,21 +125,22 @@
struct call_f_after {
typedef void result_type;
#ifndef ACT_WRAPPER
- void operator()(AE& ae, F fn, D& d, typename AE:: template handle<typename boost::result_of<F()>::type>::type& h) {
+ void operator()(AE& ae, F fn, D& d,
+ typename asynchronous_completion_token<AE,typename boost::result_of<F()>::type>::type& h
+ ) {
//d.wait();
boost::interthreads::wait_all(d);
- typename AE:: template handle<typename boost::result_of<F()>::type>::type tmp = fork(ae, fn);
- //h = boost::move(tmp);
- h = tmp;
-
+ typename asynchronous_completion_token<AE,typename boost::result_of<F()>::type>::type tmp = fork(ae, fn);
+ h = boost::move(tmp);
}
#else
- void operator()(AE& ae, F fn, D& d, act_wrapper<typename AE:: template handle<typename boost::result_of<F()>::type>::type>& h) {
+ void operator()(AE& ae, F fn, D& d, act_wrapper<
+ typename asynchronous_completion_token<AE,typename boost::result_of<F()>::type>::type>& h
+ ) {
//d.wait();
boost::interthreads::wait_all(d);
- typename AE:: template handle<typename boost::result_of<F()>::type>::type tmp = fork(ae, fn);
- //h = boost::move(tmp);
- h.set_initialized(tmp);
+ typename asynchronous_completion_token<AE,typename boost::result_of<F()>::type>::type tmp = fork(ae, fn);
+ h.set(boost::move(tmp));
}
#endif
};
@@ -136,14 +150,18 @@
struct fork_after {
#ifndef ACT_WRAPPER
static void
- apply(AE& ae, F fn, D& d, typename AE:: template handle<typename boost::result_of<F()>::type>::type& h ) {
+ 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
static typename result_of::fork_after<AE,F>::type
apply(AE& ae, F fn, D& d) {
- act_wrapper<typename AE:: template handle<typename boost::result_of<F()>::type>::type> h;
+ act_wrapper<
+ 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)));
return h;
@@ -154,7 +172,8 @@
template< typename AE, typename F, typename D>
#ifndef ACT_WRAPPER
void
-fork_after( AE& ae, F fn, D& d, typename AE:: template handle<typename boost::result_of<F()>::type>::type& h) {
+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
@@ -164,25 +183,30 @@
}
#endif
-#if 0
-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 ) );
-}
-
-template< typename AE, typename F, typename A1, typename A2 >
-typename asynchronous_completion_token<AE, typename boost::result_of<F(A1,A2)>::type >::type
-fork( AE& ae, F fn, A1 a1, A2 a2 ) {
- return ae.fork( bind( fn, a1, a2 ) );
-}
-
-template< typename AE, typename F, typename A1, typename A2, typename A3 >
-typename asynchronous_completion_token<AE, typename boost::result_of<F(A1,A2,A3)>::type >::type
-fork( AE& ae, F fn, A1 a1, A2 a2, A3 a3 ) {
- return ae.fork( bind( fn, a1, a2, a3 ) );
+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 );
}
-#endif
+
+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 >
+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 >
+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 );
+}
+
}
}
Added: sandbox/interthreads/boost/interthreads/future_traits.hpp
==============================================================================
--- (empty file)
+++ sandbox/interthreads/boost/interthreads/future_traits.hpp 2009-01-25 07:48:12 EST (Sun, 25 Jan 2009)
@@ -0,0 +1,177 @@
+#ifndef BOOST_INTERTHREADS_FUTURE_TRAITS__HPP
+#define BOOST_INTERTHREADS_FUTURE_TRAITS__HPP
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// Based on the threader/joiner design from of Kevlin Henney (n1883)
+//
+// See http://www.boost.org/libs/interthreads for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#include <boost/interthreads/act_traits.hpp>
+#include <boost/thread/detail/move.hpp>
+//#include <boost/thread/thread.hpp>
+#include <boost/futures/future.hpp>
+//#include <boost/utility/result_of.hpp>
+#include <boost/type_traits/is_fundamental.hpp>
+#include <boost/type_traits/is_convertible.hpp>
+#include <boost/mpl/if.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+
+namespace boost {
+namespace interthreads {
+
+ 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
+
+ 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 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<>
+ 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 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<>
+ 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;
+ }
+
+ };
+
+}
+}
+
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif
+
Modified: sandbox/interthreads/boost/interthreads/launcher.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/launcher.hpp (original)
+++ sandbox/interthreads/boost/interthreads/launcher.hpp 2009-01-25 07:48:12 EST (Sun, 25 Jan 2009)
@@ -20,6 +20,8 @@
#include <boost/utility/result_of.hpp>
#include <boost/interthreads/fork.hpp>
+#include <boost/interthreads/act_traits.hpp>
+#include <boost/interthreads/future_traits.hpp>
#include <boost/config/abi_prefix.hpp>
@@ -111,12 +113,6 @@
shared_future<T>& operator()(shared_future<T>& f) { return f; }
};
-
-template <typename ResultType>
-struct act_value<unique_future<ResultType> > {
- typedef ResultType type;
-};
-
template <typename R>
struct is_movable<unique_future<R> > : mpl::true_{};
@@ -127,11 +123,6 @@
struct has_thread_if<unique_future<R> > : mpl::false_{};
-template <typename ResultType>
-struct act_value<shared_future<ResultType> > {
- typedef ResultType type;
-};
-
template <typename R>
struct is_movable<shared_future<R> > : mpl::true_{};
@@ -140,6 +131,148 @@
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
+
+ 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 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<>
+ 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 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<>
+ 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;
+ }
+
+ };
+
+#endif
}
}
Modified: sandbox/interthreads/boost/interthreads/scheduler.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/scheduler.hpp (original)
+++ sandbox/interthreads/boost/interthreads/scheduler.hpp 2009-01-25 07:48:12 EST (Sun, 25 Jan 2009)
@@ -75,11 +75,12 @@
namespace partial_specialization_workaround {
template< typename Channel, typename F >
struct fork<boost::tp::pool<Channel>,F> {
- typename result_of::fork<boost::tp::pool<Channel>, F>::type
+ 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> > {
@@ -87,9 +88,10 @@
shared_future<T>& operator()(tp::task<T>& act) { return act.get_future(); }
};
+
template <typename ResultType>
-struct act_value<tp::task<ResultType> > {
- typedef ResultType type;
+struct act_traits< tp::task<ResultType> > {
+ typedef ResultType move_dest_type;
};
template <typename R>
@@ -104,7 +106,17 @@
}
}
+#if 1
+namespace boost
+{
+ template<typename T>
+ boost::tp::task<T>& move(boost::tp::task<T>& t)
+ {
+ return t;
+ }
+}
+#endif
#include <boost/config/abi_suffix.hpp>
#endif
Modified: sandbox/interthreads/boost/interthreads/threader.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/threader.hpp (original)
+++ sandbox/interthreads/boost/interthreads/threader.hpp 2009-01-25 07:48:12 EST (Sun, 25 Jan 2009)
@@ -25,6 +25,7 @@
#include <boost/utility/result_of.hpp>
#include <boost/interthreads/fork.hpp>
+#include <boost/interthreads/launcher.hpp>
#include <boost/config/abi_prefix.hpp>
@@ -34,12 +35,15 @@
template <typename ResultType>
class unique_joiner;
-
+template<typename T>
+struct act_traits<unique_joiner<T> > : act_traits<unique_future<T> > {};
+
template <typename ResultType>
class unique_joiner {
public:
typedef ResultType result_type;
+ typedef typename act_traits<unique_joiner<ResultType> >::move_dest_type move_dest_type;
private:
struct unique_joiner_data {
unique_future< result_type > fut_;
@@ -147,17 +151,10 @@
{
return join_until(get_system_time()+rel_time);
}
-#if 0
- result_type get() const {
- return const_cast<unique_future< result_type >*>(&(data_->fut_))->get();
- }
-
- result_type operator()() const { return get(); }
-#endif
- result_type get() {
+ move_dest_type get() {
return data_->fut_.get();
}
- result_type operator()() { return get(); }
+ move_dest_type operator()() { return get(); }
bool is_ready() const {
return data_->fut_.is_ready();
@@ -202,10 +199,6 @@
return data_->fut_;
}
};
-template <typename ResultType>
-struct act_value<unique_joiner<ResultType> > {
- typedef ResultType type;
-};
template <typename R>
struct is_movable<unique_joiner<R> > : mpl::true_{};
@@ -257,15 +250,19 @@
template <typename T>
unique_future<T>& operator()(unique_joiner<T>& j) { return j.get_future(); }
};
-
-
+
template <typename ResultType>
class shared_joiner;
-
+
+template<typename T>
+struct act_traits<shared_joiner<T> > : act_traits<shared_future<T> > {};
+
template <typename ResultType>
class shared_joiner {
public:
typedef ResultType result_type;
+ typedef typename act_traits<shared_joiner<ResultType> >::move_dest_type move_dest_type;
+
private:
struct shared_joiner_data {
shared_future< result_type > fut_;
@@ -380,15 +377,11 @@
{
return join_until(get_system_time()+rel_time);
}
- result_type get() {
+ move_dest_type get() const {
return data_->fut_.get();
}
- result_type operator()() { return get(); }
- result_type get() const {
- return const_cast<shared_future< result_type >*>(&(data_->fut_))->get();
- }
- result_type operator()() const { return get(); }
+ move_dest_type operator()() const { return get(); }
bool is_ready() const {
return data_->fut_.is_ready();
@@ -435,11 +428,6 @@
};
template <typename R>
-struct act_value<shared_joiner<R> > {
- typedef R type;
-};
-
-template <typename R>
struct is_movable<shared_joiner<R> > : mpl::true_{};
template <typename R>
Modified: sandbox/interthreads/boost/interthreads/typeof/launcher.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/typeof/launcher.hpp (original)
+++ sandbox/interthreads/boost/interthreads/typeof/launcher.hpp 2009-01-25 07:48:12 EST (Sun, 25 Jan 2009)
@@ -15,13 +15,13 @@
#define BOOST_INTERTHREADS_TYPEOF_LAUNCHER__HPP
#include <boost/interthreads/launcher.hpp>
+#include <boost/interthreads/typeof/future.hpp>
#include <boost/typeof/typeof.hpp>
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
BOOST_TYPEOF_REGISTER_TYPE(boost::interthreads::launcher)
-
BOOST_TYPEOF_REGISTER_TYPE(boost::interthreads::shared_launcher)
#endif
Modified: sandbox/interthreads/boost/interthreads/typeof/scheduler.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/typeof/scheduler.hpp (original)
+++ sandbox/interthreads/boost/interthreads/typeof/scheduler.hpp 2009-01-25 07:48:12 EST (Sun, 25 Jan 2009)
@@ -19,7 +19,7 @@
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
-BOOST_TYPEOF_REGISTER_TEMPLATE(boost::tp::pool, 1)
+//BOOST_TYPEOF_REGISTER_TEMPLATE(boost::tp::pool, 1)
BOOST_TYPEOF_REGISTER_TEMPLATE(boost::tp::task, 1)
#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-01-25 07:48:12 EST (Sun, 25 Jan 2009)
@@ -42,13 +42,8 @@
struct partial;
template <typename P>
struct partial<2,P> {
-#if 1
typedef typename pair_void<P>::value_type T;
typedef typename pair_void<P>::type type;
-#else
- typedef P T;
- typedef std::pair<unsigned, P> type;
-#endif
template <typename H>
static type make(unsigned r, H &handles) {
return std::make_pair(r,get(r,handles));
@@ -67,13 +62,8 @@
};
template <typename P>
struct partial<3,P> {
-#if 1
typedef typename pair_void<P>::value_type T;
typedef typename pair_void<P>::type type;
-#else
- typedef P T;
- typedef std::pair<unsigned, P> type;
-#endif
template <typename H>
static type make(unsigned r, H &handles) {
return std::make_pair(r,get(r,handles));
@@ -96,9 +86,6 @@
struct partial_aux {
typedef pair_void<void>::value_type T;
typedef pair_void<void>::type type;
- //typedef void T;
- //typedef std::pair<unsigned,unsigned> type;
- //typedef std::make_pair<unsigned, P> type;
template <typename H>
static type make(unsigned i,H &h) {
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