|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r52735 - sandbox/interthreads/boost/interthreads
From: vicente.botet_at_[hidden]
Date: 2009-05-02 10:08:59
Author: viboes
Date: 2009-05-02 10:08:54 EDT (Sat, 02 May 2009)
New Revision: 52735
URL: http://svn.boost.org/trac/boost/changeset/52735
Log:
Boost.Interthreads V0.1.3 : Removal of Async
Removed:
sandbox/interthreads/boost/interthreads/act_traits.hpp
sandbox/interthreads/boost/interthreads/algorithm.hpp
sandbox/interthreads/boost/interthreads/asynchronous_executor_decorator.hpp
sandbox/interthreads/boost/interthreads/asynchronous_executor_wait_decorator.hpp
sandbox/interthreads/boost/interthreads/basic_threader.hpp
sandbox/interthreads/boost/interthreads/fork.hpp
sandbox/interthreads/boost/interthreads/fork_after.hpp
sandbox/interthreads/boost/interthreads/fork_all.hpp
sandbox/interthreads/boost/interthreads/launcher.hpp
sandbox/interthreads/boost/interthreads/scheduler.hpp
sandbox/interthreads/boost/interthreads/scoped_act.hpp
sandbox/interthreads/boost/interthreads/threader.hpp
sandbox/interthreads/boost/interthreads/wait_for_all.hpp
sandbox/interthreads/boost/interthreads/wait_for_any.hpp
Deleted: sandbox/interthreads/boost/interthreads/act_traits.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/act_traits.hpp 2009-05-02 10:08:54 EDT (Sat, 02 May 2009)
+++ (empty file)
@@ -1,64 +0,0 @@
-#ifndef BOOST_INTERTHREADS_ACT_TRAITS__HPP
-#define BOOST_INTERTHREADS_ACT_TRAITS__HPP
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// (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)
-//
-// See http://www.boost.org/libs/interthreads for documentation.
-//
-//////////////////////////////////////////////////////////////////////////////
-
-#include <boost/bind.hpp>
-#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>
-
-
-namespace boost {
-namespace interthreads {
-
- 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_thread_if : mpl::false_{};
-
- 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();
- }
- };
-
-}
-}
-
-
-#include <boost/config/abi_suffix.hpp>
-
-#endif
-
Deleted: sandbox/interthreads/boost/interthreads/algorithm.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/algorithm.hpp 2009-05-02 10:08:54 EDT (Sat, 02 May 2009)
+++ (empty file)
@@ -1,59 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-//
-// (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.
-//
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef BOOST_INTERTHREADS_ALGORITHM__HPP
-#define BOOST_INTERTHREADS_ALGORITHM__HPP
-
-#include <boost/interthreads/fork.hpp>
-#include <boost/interthreads/scoped_act.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/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/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
Deleted: sandbox/interthreads/boost/interthreads/asynchronous_executor_decorator.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/asynchronous_executor_decorator.hpp 2009-05-02 10:08:54 EDT (Sat, 02 May 2009)
+++ (empty file)
@@ -1,91 +0,0 @@
-#ifndef BOOST_INTERTHREADS_ASYNCHRONOUS_EXECUTOR_DECORATOR__HPP
-#define BOOST_INTERTHREADS_ASYNCHRONOUS_EXECUTOR_DECORATOR__HPP
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// (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.
-//
-//////////////////////////////////////////////////////////////////////////////
-
-#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 asynchronous_completion_token<AE, T>::type type;
- };
-
- template <typename F>
- 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);
- }
-
- asynchronous_executor_decorator() :AE() {};
-
- 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)
- : AE(f)
-#endif
- {}
-
- // move support
-#ifdef BOOST_HAS_RVALUE_REFS
-#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
-
-
- };
-
-
- template <typename AE, template <class> class Decorator>
- struct get_future<asynchronous_executor_decorator<AE, Decorator> > {
- template <typename T>
- struct future_type {
- 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)
- { return j.get_future(); }
- };
-
-}
-}
-
-#include <boost/config/abi_suffix.hpp>
-
-
-#endif
-
Deleted: sandbox/interthreads/boost/interthreads/asynchronous_executor_wait_decorator.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/asynchronous_executor_wait_decorator.hpp 2009-05-02 10:08:54 EDT (Sat, 02 May 2009)
+++ (empty file)
@@ -1,104 +0,0 @@
-#ifndef BOOST_INTERTHREADS_ASYNCHRONOUS_WAIT_EXECUTOR_DECORATOR__HPP
-#define BOOST_INTERTHREADS_ASYNCHRONOUS_WAIT_EXECUTOR_DECORATOR__HPP
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// (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.
-//
-//////////////////////////////////////////////////////////////////////////////
-
-#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_wait_decorator : AE {
-
-#if 0
- template <typename F>
- static typename boost::result_of<F()>::type waiter(bool started, condition_variable cond, F f) {
- typename boost::result_of<F()>::type res = f();
- started
- }
-#endif
- template <typename T>
- struct handle {
- typedef typename AE::template handle<T>::type type;
- };
-
- template <typename F>
- typename AE::template handle< typename boost::result_of<F()>::type >::type
- fork( F fn ) {
- bool started;
- condition_variable cond;
- typename result_of::fork<AE, F>::type act= this->AE::fork(Decorator<typename boost::result_of<F()>::type>(fn));
- while (!started) cond.wait();
- return boost::move(act);
- }
-
- asynchronous_executor_wait_decorator() :AE() {};
-
- template <typename Nullary>
-#ifdef BOOST_THREAD_HAS_THREAD_ATTR
- asynchronous_executor_wait_decorator(thread::native_handle_attr_type& attr, Nullary f)
- : AE(attr, f)
-#else
- asynchronous_executor_wait_decorator(Nullary f)
- : AE(f)
-#endif
- {}
-
- // move support
-#ifdef BOOST_HAS_RVALUE_REFS
-#else
- asynchronous_executor_wait_decorator(boost::detail::thread_move_t<asynchronous_executor_wait_decorator> x)
- : AE(boost::move(*(static_cast<AE*>(&(x.member))))) {}
-
- asynchronous_executor_wait_decorator& operator=(boost::detail::thread_move_t<asynchronous_executor_wait_decorator> x) {
- return move();
- }
-
- operator boost::detail::thread_move_t<asynchronous_executor_wait_decorator>() {
- return move();
- }
-
- boost::detail::thread_move_t<asynchronous_executor_wait_decorator> move() {
- return boost::detail::thread_move_t<asynchronous_executor_wait_decorator>(*this);
- }
-
-#endif
-
-
- };
-
-
- template <typename AE, template <class> class Decorator>
- struct get_future<asynchronous_executor_wait_decorator<AE, Decorator> > {
- template <typename T>
- struct future_type {
- 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)
- { return j.get_future(); }
- };
-
-}
-}
-
-#include <boost/config/abi_suffix.hpp>
-
-
-#endif
-
Deleted: sandbox/interthreads/boost/interthreads/basic_threader.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/basic_threader.hpp 2009-05-02 10:08:54 EDT (Sat, 02 May 2009)
+++ (empty file)
@@ -1,152 +0,0 @@
-#ifndef BOOST_INTERTHREADS_BASIC_THREADER__HPP
-#define BOOST_INTERTHREADS_BASIC_THREADER__HPP
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// (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)
-//
-// See http://www.boost.org/libs/interthreads for documentation.
-//
-//////////////////////////////////////////////////////////////////////////////
-
-#include <boost/thread/detail/move.hpp>
-#include <boost/thread/thread.hpp>
-
-#include <boost/interthreads/algorithm.hpp>
-
-#include <boost/config/abi_prefix.hpp>
-
-
-namespace boost {
-namespace interthreads {
-
-
-class basic_threader {
-#ifdef BOOST_THREAD_HAS_THREAD_ATTR
-private:
- thread::native_handle_attr_type attr_;
-public:
- thread::native_handle_attr_type& attr() {
- return attr_;
- }
-#endif
-
-public:
- template <typename T>
- struct handle {
- typedef thread type;
- };
-
- template <typename F>
- thread fork(F f) {
-#ifdef BOOST_THREAD_HAS_THREAD_ATTR
- thread th(attr(), f);
-#else
- thread th(f);
-#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);
- }
- };
- }
-
-
-}
-}
-
-
-#include <boost/config/abi_suffix.hpp>
-
-#endif
-
Deleted: sandbox/interthreads/boost/interthreads/fork.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/fork.hpp 2009-05-02 10:08:54 EDT (Sat, 02 May 2009)
+++ (empty file)
@@ -1,86 +0,0 @@
-#ifndef BOOST_INTERTHREADS_FORK__HPP
-#define BOOST_INTERTHREADS_FORK__HPP
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// (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)
-//
-// See http://www.boost.org/libs/interthreads for documentation.
-//
-//////////////////////////////////////////////////////////////////////////////
-
-#include <boost/bind.hpp>
-#include <boost/utility/result_of.hpp>
-#include <boost/futures/future.hpp>
-#include <boost/interthreads/act_traits.hpp>
-
-#include <boost/config/abi_prefix.hpp>
-
-
-namespace boost {
-namespace interthreads {
-
-
-
-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 >
-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 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 >
-typename asynchronous_completion_token<AE, typename boost::result_of<F(A1)>::type >::type
-fork( AE& ae, F fn, A1 a1 ) {
- return interthreads::fork(ae, 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 interthreads::fork(ae, 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 interthreads::fork( ae, bind( fn, a1, a2, a3 ) );
-}
-
-template< typename AE, typename F, typename A1, typename A2, typename A3, typename A4 >
-typename asynchronous_completion_token<AE, typename boost::result_of<F(A1,A2,A3,A4)>::type >::type
-fork( AE& ae, F fn, A1 a1, A2 a2, A3 a3, A4 a4 ) {
- return interthreads::fork( ae, bind( fn, a1, a2, a3, a4 ) );
-}
-
-}
-}
-
-
-#include <boost/config/abi_suffix.hpp>
-
-#endif
-
Deleted: sandbox/interthreads/boost/interthreads/fork_after.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/fork_after.hpp 2009-05-02 10:08:54 EDT (Sat, 02 May 2009)
+++ (empty file)
@@ -1,284 +0,0 @@
-#ifndef BOOST_INTERTHREADS_FORK_AFTER__HPP
-#define BOOST_INTERTHREADS_FORK_AFTER__HPP
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// (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)
-//
-// See http://www.boost.org/libs/interthreads for documentation.
-//
-//////////////////////////////////////////////////////////////////////////////
-
-#include <boost/bind.hpp>
-#include <boost/ref.hpp>
-#include <boost/utility/result_of.hpp>
-#include <boost/futures/future.hpp>
-#include <boost/interthreads/fork.hpp>
-#include <boost/interthreads/algorithm/wait_all.hpp>
-
-#include <boost/thread/mutex.hpp>
-#include <boost/thread/condition_variable.hpp>
-#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>
-
-
-namespace boost {
-namespace interthreads {
-
-#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_) {
- unique_lock<mutex> lk(ptr_->mtx_);
- 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();
- }
-
- 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();
- }
-
- 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)
- {}
- ACT act_;
- bool inittialized_;
- mutex mtx_;
- condition_variable cv_;
- };
- shared_ptr<data> ptr_;
-};
-
-
-template <typename ACT>
-struct is_movable<act_wrapper<ACT> > : is_movable<ACT>{};
-
-template <typename ACT>
-struct has_future_if<act_wrapper<ACT> > : has_future_if<ACT> {};
-
-template <typename ACT>
-struct has_thread_if<act_wrapper<ACT> > : has_thread_if<ACT>{};
-
-
-namespace result_of {
- template <typename AE,typename F>
- struct fork_after {
- typedef typename boost::result_of<F()>::type result_type;
- typedef typename asynchronous_completion_token<AE, result_type>::type act_type;
- typedef act_wrapper<act_type> type;
- };
-}
-
-#else
-namespace result_of {
- template <typename AE,typename F>
- struct fork_after {
- typedef void type;
- };
-}
-#endif
-template <typename AE, typename F, typename D>
-struct call_f_after {
- typedef void result_type;
-#ifndef ACT_WRAPPER
- 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 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 asynchronous_completion_token<AE,typename boost::result_of<F()>::type>::type>& h
- ) {
- //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(tmp);
- //h.set(boost::move(tmp));
-
- }
-#endif
-};
-
-namespace partial_specialization_workaround {
-template< typename AE, typename F, typename D >
-struct fork_after {
-#ifndef ACT_WRAPPER
- 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
- static typename result_of::fork_after<AE,F>::type
- apply(AE& ae, F fn, D& d) {
- 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;
- }
-#endif
-};
-}
-template< typename AE, typename F, typename D>
-#ifndef ACT_WRAPPER
-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
-fork_after( AE& ae, F fn, D& d) {
- return partial_specialization_workaround::fork_after<AE,F,D>::apply(ae,fn, d);
-}
-#endif
-
-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 >
-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 );
-}
-
-}
-}
-
-
-#include <boost/config/abi_suffix.hpp>
-
-#endif
-
Deleted: sandbox/interthreads/boost/interthreads/fork_all.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/fork_all.hpp 2009-05-02 10:08:54 EDT (Sat, 02 May 2009)
+++ (empty file)
@@ -1,163 +0,0 @@
-#ifndef BOOST_INTERTHREADS_FORK_ALL__HPP
-#define BOOST_INTERTHREADS_FORK_ALL__HPP
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// (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)
-//
-// See http://www.boost.org/libs/interthreads for documentation.
-//
-//////////////////////////////////////////////////////////////////////////////
-
-#include <boost/interthreads/fork.hpp>
-#include <boost/thread/detail/move.hpp>
-#include <boost/fusion/include/tuple.hpp>
-#include <boost/utility/result_of.hpp>
-
-#include <boost/config/abi_prefix.hpp>
-
-
-namespace boost {
-namespace interthreads {
-
-#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>
- struct fork_all<AE, fusion::tuple<F1> > {
- typedef fusion::tuple<
- typename result_of::fork<AE,F1>::type
- > type;
- };
- template <typename AE, typename F1, typename F2>
- struct fork_all<AE, fusion::tuple<F1,F2> > {
- typedef fusion::tuple<
- typename result_of::fork<AE,F1>::type,
- typename result_of::fork<AE,F2>::type
- > type;
- };
- template <typename AE, typename F1, typename F2, typename F3>
- struct fork_all<AE, fusion::tuple<F1,F2,F3> > {
- typedef fusion::tuple<
- typename fork<AE,F1>::type,
- typename fork<AE,F2>::type,
- typename fork<AE,F3>::type
- > type;
- };
- template <typename AE, typename F1, typename F2, typename F3, typename F4>
- struct fork_all<AE, fusion::tuple<F1,F2,F3,F4> > {
- typedef fusion::tuple<
- typename fork<AE,F1>::type,
- typename fork<AE,F2>::type,
- typename fork<AE,F3>::type,
- typename fork<AE,F4>::type
- > type;
- };
-
-}
-
-
-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;
- typename result_of::fork<AE, F1>::type j1 = interthreads::fork(ae, f1);
- return type(j1);
-}
-
-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;
- typename result_of::fork<AE, F1>::type j1 =interthreads::fork(ae, f1);
- typename result_of::fork<AE, F2>::type j2 =interthreads::fork(ae, f2);
- return type(j1,j2);
-}
-
-#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;
- return type(interthreads::fork(ae, f1),interthreads::fork(ae, f2),interthreads::fork(ae, f3));
-}
-
-template< typename AE, typename F1, typename F2, typename F3, typename F4>
-typename result_of::fork_all<AE, fusion::tuple<F1,F2,F3,F4> >::type
-fork_all( AE& ae, F1 f1, F2 f2, F3 f3, F4 f4 ) {
- typedef typename result_of::fork_all<AE, fusion::tuple<F1,F2,F3,F4> >::type type;
- return type(interthreads::fork(ae, f1),interthreads::fork(ae, f2),interthreads::fork(ae, f3),interthreads::fork(ae, f4));
-}
-
-}
-}
-
-
-#include <boost/config/abi_suffix.hpp>
-
-#endif
-
Deleted: sandbox/interthreads/boost/interthreads/launcher.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/launcher.hpp 2009-05-02 10:08:54 EDT (Sat, 02 May 2009)
+++ (empty file)
@@ -1,207 +0,0 @@
-#ifndef BOOST_INTERTHREADS_LAUNCHER__HPP
-#define BOOST_INTERTHREADS_LAUNCHER__HPP
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// (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)
-//
-// See http://www.boost.org/libs/interthreads for documentation.
-//
-//////////////////////////////////////////////////////////////////////////////
-
-#include <boost/thread/detail/move.hpp>
-#include <boost/thread/thread.hpp>
-#include <boost/futures/future.hpp>
-#include <boost/utility/result_of.hpp>
-
-#include <boost/interthreads/algorithm.hpp>
-#include <boost/interthreads/act_traits.hpp>
-#include <boost/interthreads/future_traits.hpp>
-
-#include <boost/config/abi_prefix.hpp>
-
-
-namespace boost {
-namespace interthreads {
-
-class launcher {
-#ifdef BOOST_THREAD_HAS_THREAD_ATTR
-private:
- thread::native_handle_attr_type attr_;
-public:
- thread::native_handle_attr_type& attr() {
- return attr_;
- }
-#endif
-
-public:
- template <typename T>
- struct handle {
- typedef unique_future<T> type;
- };
-
- template <typename F>
- unique_future<typename boost::result_of<F()>::type>
- fork(F f) {
- typedef typename boost::result_of<F()>::type result_type;
- packaged_task<result_type> tsk(f);
- 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(act);
- }
-
-};
-
-
-class shared_launcher {
-#ifdef BOOST_THREAD_HAS_THREAD_ATTR
-private:
- thread::native_handle_attr_type attr_;
-public:
- thread::native_handle_attr_type& attr() {
- return attr_;
- }
-#endif
-
-public:
- template <typename T>
- struct handle {
- typedef shared_future<T> type;
- };
-
- template <typename F>
- shared_future<typename boost::result_of<F()>::type>
- fork(F f) {
- typedef typename boost::result_of<F()>::type result_type;
- packaged_task<result_type> tsk(f);
- 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 act;
- }
-
-};
-
-template <>
-struct get_future<launcher> {
- template <typename T>
- struct future_type {
- typedef unique_future<T> type;
- };
- template <typename T>
- unique_future<T>& operator()(unique_future<T>& f) { return f; }
-};
-
-template <>
-struct get_future<shared_launcher> {
- template <typename T>
- struct future_type {
- typedef shared_future<T> type;
- };
- template <typename T>
- shared_future<T>& operator()(shared_future<T>& f) { return f; }
-};
-
-template <typename R>
-struct is_movable<unique_future<R> > : mpl::true_{};
-
-template <typename R>
-struct has_future_if<unique_future<R> > : mpl::true_{};
-
-template <typename R>
-struct has_thread_if<unique_future<R> > : mpl::false_{};
-
-
-template <typename R>
-struct is_movable<shared_future<R> > : mpl::true_{};
-
-template <typename R>
-struct has_future_if<shared_future<R> > : mpl::true_{};
-
-template <typename R>
-struct has_thread_if<shared_future<R> > : mpl::true_{};
-
- namespace partial_specialization_workaround {
- template <typename R>
- struct join<unique_future<R> > {
- static typename result_of::template join<unique_future<R> >::type apply( unique_future<R>& act) {
- return act.wait();
- }
- };
- 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 R>
- struct join_until<unique_future<R> > {
- static typename result_of::template join_until<unique_future<R> >::type apply( unique_future<R>& act, const system_time& abs_time ) {
- return act.timed_wait_until(abs_time);
- }
- };
- 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 <typename R, typename Duration>
- struct join_for<unique_future<R>, Duration> {
- static typename result_of::template join_for<unique_future<R>,Duration>::type apply( unique_future<R>& act, Duration rel_time ) {
- return act.timed_wait(rel_time);
- }
- };
- 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 R>
- struct wait_until<unique_future<R> > {
- static typename result_of::template wait_until<unique_future<R> >::type apply( unique_future<R>& act, const system_time& abs_time ) {
- return act.timed_wait_until(abs_time);
- }
- };
- 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 <typename R, typename Duration>
- struct wait_for<unique_future<R>, Duration> {
- static typename result_of::template wait_for<unique_future<R>,Duration>::type apply( unique_future<R>& act, Duration rel_time ) {
- return act.timed_wait(rel_time);
- }
- };
- 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);
- }
- };
- }
-
-
-}
-}
-
-
-#include <boost/config/abi_suffix.hpp>
-
-#endif
-
Deleted: sandbox/interthreads/boost/interthreads/scheduler.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/scheduler.hpp 2009-05-02 10:08:54 EDT (Sat, 02 May 2009)
+++ (empty file)
@@ -1,266 +0,0 @@
-#ifndef BOOST_INTERTHREADS_SCHEDULER__HPP
-#define BOOST_INTERTHREADS_SCHEDULER__HPP
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// (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)
-//
-// See http://www.boost.org/libs/interthreads for documentation.
-//
-//////////////////////////////////////////////////////////////////////////////
-
-#include <boost/thread/detail/move.hpp>
-#include <boost/thread/condition_variable.hpp>
-//#include <boost/thread/thread.hpp>
-#include <boost/thread/tss.hpp>
-#include <boost/shared_ptr.hpp>
-#include <boost/bind.hpp>
-#include <boost/tuple/tuple.hpp>
-#include <boost/tp/pool.hpp>
-#include <boost/futures/future.hpp>
-#include <boost/utility/result_of.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:
- 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>
- typename handle<typename boost::result_of<F()>::type>::type
- fork(F f) {
- return _pool.submit(f);
- }
-
-};
-
-template <typename Channel>
-struct get_future<scheduler<Channel> > {
- template <typename T>
- struct future_type {
- typedef shared_future<T> type;
- };
- template <typename T>
- shared_future<T>& operator()(tp::task<T>& act) { return act.get_future(); }
-};
-
-
-#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 C>
-struct get_future<tp::pool<C> > {
- template <typename T>
- struct future_type {
- typedef shared_future<T> type;
- };
- template <typename T>
- 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.result(); }
-};
-
-#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;
-};
-
-template <typename R>
-struct is_movable<tp::task<R> > : mpl::false_{};
-
-template <typename R>
-struct has_future_if<tp::task<R> > : mpl::true_{};
-
-template <typename R>
-struct has_thread_if<tp::task<R> > : mpl::true_{};
-#endif
-
-#ifdef TASK_POOL
-
-
-
- namespace partial_specialization_workaround {
- template <typename Pool, typename R, typename Duration>
- struct wait_until<tp::task<Pool, R> > {
- static typename result_of::template wait_until<tp::task<Pool, R> >::type apply( tp::task<Pool, R>& act, const system_time& abs_time ) {
- return act.result().timed_wait_until(abs_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 act.result().timed_wait(rel_time);
- }
- };
-
- 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.result().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.result().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 >
- struct interruption_requested<tp::task<Pool, R> > {
- static typename result_of::template interruption_requested<tp::task<Pool, R> >::type apply( tp::task<Pool, R>& act ) {
- return act.interruption_requested();
- }
- };
- }
-#else
- namespace partial_specialization_workaround {
- template< typename R >
- struct wait<tp::task<R> > {
- static typename result_of::template wait<tp::task<R> >::type apply( tp::task<R>& act ) {
- return act.result().wait();
- }
- };
-
- template <typename R>
- struct wait_until<tp::task<R> > {
- static typename result_of::template wait_until<tp::task<R> >::type apply( tp::task<R>& act, const system_time& abs_time ) {
- return act.result().timed_wait_until(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);
- }
- };
-
- template <typename R>
- struct get<tp::task<R> > {
- static typename result_of::template get<tp::task<R> >::type apply( tp::task<R>& act ) {
- return act.result().get();
- }
- };
-
- template <typename R>
- struct join<tp::task<R> > {
- static typename result_of::template join<tp::task<R> >::type apply( tp::task<R>& act) {
- return interthreads::wait(act);
- }
- };
- 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 interthreads::wait_until(act, 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 >
- struct interruption_requested<tp::task<R> > {
- static typename result_of::template interruption_requested<tp::task<R> >::type apply( tp::task<R>& act ) {
- return act.interruption_requested();
- }
- };
- }
-
-
-#endif
-}
-}
-
-#include <boost/config/abi_suffix.hpp>
-
-#endif
-
Deleted: sandbox/interthreads/boost/interthreads/scoped_act.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/scoped_act.hpp 2009-05-02 10:08:54 EDT (Sat, 02 May 2009)
+++ (empty file)
@@ -1,92 +0,0 @@
-#ifndef BOOST_INTERTHREADS_SCOPED_ACT__HPP
-#define BOOST_INTERTHREADS_SCOPED_ACT__HPP
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// (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)
-//
-// See http://www.boost.org/libs/interthreads for documentation.
-//
-//////////////////////////////////////////////////////////////////////////////
-
-#include <boost/interthreads/algorithm/joinable.hpp>
-#include <boost/interthreads/algorithm/join.hpp>
-#include <boost/interthreads/fork.hpp>
-
-#include <boost/config/abi_prefix.hpp>
-
-
-namespace boost {
-namespace interthreads {
-
- template <typename ACT>
- class scoped_join {
- ACT& act_;
- public:
- scoped_join(ACT& act) : act_(act) {}
- ~scoped_join() {
- if (interthreads::joinable(act_)) {
- interthreads::join(act_);
- }
- }
- ACT& get() {return act_;};
- };
-
- template <typename ACT>
- class scoped_terminate {
- ACT& act_;
- public:
- scoped_terminate(ACT& act) : act_(act) {}
- ~scoped_terminate() {
- if (interthreads::joinable(act_)) {
- std::terminate();
- }
- }
- ACT& get() {return act_;};
- };
-
- template <typename ACT>
- class scoped_fork_join {
- ACT act_;
- public:
- template <typename AE, typename F>
- scoped_fork_join(AE& ae, F f)
- : act_(interthreads::fork(ae, f))
- {}
- ~scoped_fork_join() {
- if (interthreads::joinable(act_)) {
- interthreads::join(act_);
- }
- }
- ACT& get() {return act_;};
- };
-
- template <typename ACT>
- class scoped_fork_terminate {
- ACT act_;
- public:
- template <typename AE, typename F>
- scoped_fork_terminate(AE& ae, F f)
- : act_(interthreads::fork(ae, f))
- {}
- ~scoped_fork_terminate() {
- if (interthreads::joinable(act_)) {
- std::terminate();
- }
- }
- ACT& get() {return act_;};
- };
-
-}
-}
-
-
-#include <boost/config/abi_suffix.hpp>
-
-#endif
-
Deleted: sandbox/interthreads/boost/interthreads/threader.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/threader.hpp 2009-05-02 10:08:54 EDT (Sat, 02 May 2009)
+++ (empty file)
@@ -1,564 +0,0 @@
-#ifndef BOOST_INTERTHREADS_THREADER__HPP
-#define BOOST_INTERTHREADS_THREADER__HPP
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// (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)
-//
-// See http://www.boost.org/libs/interthreads for documentation.
-//
-//////////////////////////////////////////////////////////////////////////////
-
-#include <boost/thread/detail/move.hpp>
-#include <boost/thread/condition_variable.hpp>
-#include <boost/thread/thread.hpp>
-#include <boost/thread/tss.hpp>
-#include <boost/shared_ptr.hpp>
-#include <boost/bind.hpp>
-#include <boost/tuple/tuple.hpp>
-#include <boost/futures/future.hpp>
-#include <boost/utility/result_of.hpp>
-
-#include <boost/interthreads/fork.hpp>
-#include <boost/interthreads/launcher.hpp>
-#include <cstdlib>
-
-#include <boost/config/abi_prefix.hpp>
-
-
-namespace boost {
-namespace interthreads {
-
-namespace on_destruction {
- enum type {
- do_terminate,
- do_join,
- do_detach
- };
-}
-
-
-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_;
- thread th_;
- on_destruction::type on_destruction_;
-
- unique_joiner_data(on_destruction::type on_destruction_do= on_destruction::do_join)
- : on_destruction_(on_destruction_do)
- {}
- ~unique_joiner_data() {
- if (th_.joinable()) {
- if (on_destruction_== on_destruction::do_terminate) {
- std::terminate();
- } else if (on_destruction_== on_destruction::do_join) {
- th_.join();
- }
- }
- }
-
- template <typename Nullary>
-#ifdef BOOST_THREAD_HAS_THREAD_ATTR
- unique_joiner_data(thread::native_handle_attr_type& attr, Nullary f, on_destruction::type on_destruction_do)
- : on_destruction_(on_destruction_do)
- {
- packaged_task<result_type> tsk(f);
- fut_ = tsk.get_future();
- thread th(attr, boost::move(tsk));
- th_ = boost::move(th);
- }
-#else
- unique_joiner_data(Nullary f, on_destruction::type on_destruction_do)
- : on_destruction_(on_destruction_do)
- {
- packaged_task<result_type> tsk(f);
- fut_ = tsk.get_future();
-#if 0
- th_ = boost::move(tsk);
-#else
- thread th(boost::move(tsk));
- th_ = boost::move(th);
-#endif
- }
-#endif
-
- };
- shared_ptr<unique_joiner_data> data_;
- typedef unique_joiner_data this_impl_type;
- typedef unique_joiner this_type;
-
- unique_joiner(unique_joiner<ResultType>& other);
- unique_joiner& operator=(unique_joiner<ResultType>& other);
-//protected:
-public:
- friend class unique_threader;
-
- 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, on_destruction::type on_destruction_do=on_destruction::do_join)
- : data_(new this_impl_type(attr, f,on_destruction_do))
-#else
- unique_joiner(Nullary f, on_destruction::type on_destruction_do=on_destruction::do_join)
- : data_(new this_impl_type(f,on_destruction_do))
-#endif
- {}
-
-
-public:
- // move support
-#ifdef BOOST_HAS_RVALUE_REFS
- unique_joiner(this_type&& other) {
- data_.swap(other.data_);
- }
- unique_joiner& operator=(unique_joiner&& other) {
- data_=other.data_;
- other.data_.reset(new this_impl_type());
- return *this;
- }
-
- unique_joiner&& move() {
- return static_cast<unique_joiner&&>(*this);
- }
-#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_);
- return *this;
- }
-
- 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
-
- void swap(this_type& x) {
- data_.swap(x.data_);
- }
-
- bool joinable() {
- return data_->th_.joinable();
- }
-
- void join() {
- data_->th_.join();
- }
-
- bool join_until(const system_time& abs_time) {
- return data_->th_.timed_join(abs_time);
- }
-
- template<typename TimeDuration>
- inline bool join_for(TimeDuration const& rel_time)
- {
- return join_until(get_system_time()+rel_time);
- }
- move_dest_type get() {
- return data_->fut_.get();
- }
- move_dest_type operator()() { return get(); }
-
- bool is_ready() const {
- return data_->fut_.is_ready();
- }
- bool has_exception() const {
- return data_->fut_.has_exception();
- }
- bool has_value() const {
- return data_->fut_.has_value();
- }
-
- void wait() {
- data_->fut_.wait();
- }
- bool wait_until(const system_time& abs_time) {
- return data_->fut_.timed_wait_until(abs_time);
- }
-
- template<typename TimeDuration>
- inline bool wait_for(TimeDuration const& rel_time)
- {
- return wait_until(get_system_time()+rel_time);
- }
-
- void detach() {
- data_->th_.detach();
- }
-
- void interrupt() {
- data_->th_.interrupt();
- }
-
- bool interruption_requested() const {
- return data_->th_.interruption_requested();
- }
-
- thread::id get_id() const {
- return data_->th_.get_id();
- }
-
- unique_future<result_type>& get_future() {
- return data_->fut_;
- }
-};
-
-template <typename R>
-struct is_movable<unique_joiner<R> > : mpl::true_{};
-
-template <typename R>
-struct has_future_if<unique_joiner<R> > : mpl::true_{};
-
-template <typename R>
-struct has_thread_if<unique_joiner<R> > : mpl::true_{};
-
-class unique_threader {
-#ifdef BOOST_THREAD_HAS_THREAD_ATTR
-private:
- thread_specific_ptr<thread::native_handle_attr_type> attr_;
-public:
- thread::native_handle_attr_type& attr() {
- if(attr_.get() ==0) {
- attr_.reset(new thread::native_handle_attr_type());
- };
- return *attr_.get();
- }
-#endif
-
-public:
- template <typename T>
- struct handle {
- typedef unique_joiner<T> type;
- };
- template <typename F>
- 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
- unique_joiner<result_type> unique_joiner_(attr(), f);
-#else
- unique_joiner<result_type> unique_joiner_(f);
-#endif
- return boost::move(unique_joiner_);
- }
-
-};
-
-template <>
-struct get_future<unique_threader> {
- template <typename T>
- struct future_type {
- typedef unique_future<T> type;
- };
- 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_;
- thread th_;
- on_destruction::type on_destruction_;
-
- shared_joiner_data(on_destruction::type on_destruction_do= on_destruction::do_join)
- : on_destruction_(on_destruction_do)
- {}
- ~shared_joiner_data() {
- if (th_.joinable()) {
- if (on_destruction_== on_destruction::do_terminate) {
- std::terminate();
- } else if (on_destruction_== on_destruction::do_join) {
- th_.join();
- }
- }
- }
-
- template <typename Nullary>
-#ifdef BOOST_THREAD_HAS_THREAD_ATTR
- shared_joiner_data(thread::native_handle_attr_type& attr, Nullary f, on_destruction::type on_destruction_do) {
- : on_destruction(on_destruction_do)
- {
- packaged_task<result_type> tsk(f);
- fut_ = tsk.get_future();
- thread th(attr, boost::move(tsk));
- th_ = boost::move(th);
- }
-#else
- shared_joiner_data(Nullary f, on_destruction::type on_destruction_do)
- : on_destruction_(on_destruction_do)
- {
- packaged_task<result_type> tsk(f);
- fut_ = tsk.get_future();
-#if 0
- th_ = boost::move(tsk);
-#else
- thread th(boost::move(tsk));
- th_ = boost::move(th);
-#endif
- }
-#endif
-
- };
- shared_ptr<shared_joiner_data> data_;
- typedef shared_joiner_data this_impl_type;
- typedef shared_joiner this_type;
-
-//protected:
-public:
- friend class shared_threader;
- 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, on_destruction::type on_destruction_do=on_destruction::do_join)
- : data_(new this_impl_type(attr, f,on_destruction_do))
-#else
- shared_joiner(Nullary f, on_destruction::type on_destruction_do=on_destruction::do_join)
- : data_(new this_impl_type(f,on_destruction_do))
-#endif
- {
- }
-
-
-public:
- shared_joiner() : data_() {};
- shared_joiner(const shared_joiner& other) : data_(other.data_){
- }
- this_type& operator=(const shared_joiner& other) {
- data_=other.data_;
- return *this;
- }
-
- // move support
-#ifdef BOOST_HAS_RVALUE_REFS
- shared_joiner(this_type&& other): data_(other.data_) {
- other.data_.reset(new this_impl_type());
- }
- shared_joiner& operator=(shared_joiner&& other) {
- data_=other.data_;
- other.data_.reset(new this_impl_type());
- return *this;
- }
-
- shared_joiner&& move() {
- return static_cast<shared_joiner&&>(*this);
- }
-#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_);
- return *this;
- }
-
- 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
-
- void swap(this_type& x) {
- data_.swap(x.data_);
- }
-
- bool joinable() {
- return data_->th_.joinable();
- }
-
- void join() {
- data_->th_.join();
- }
-
- bool join_until(const system_time& abs_time) {
- return data_->th_.timed_join(abs_time);
- }
-
- template<typename TimeDuration>
- inline bool join_for(TimeDuration const& rel_time)
- {
- return join_until(get_system_time()+rel_time);
- }
- 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();
- }
- bool has_exception() const {
- return data_->fut_.has_exception();
- }
- bool has_value() const {
- return data_->fut_.has_value();
- }
-
- void wait() {
- data_->fut_.wait();
- }
- bool wait_until(const system_time& abs_time) {
- return data_->fut_.timed_wait_until(abs_time);
- }
-
- template<typename TimeDuration>
- inline bool wait_for(TimeDuration const& rel_time)
- {
- return wait_until(get_system_time()+rel_time);
- }
-
- void detach() {
- data_->th_.detach();
- }
-
- void interrupt() {
- data_->th_.interrupt();
- }
-
- bool interruption_requested() const {
- return data_->th_.interruption_requested();
- }
-
- thread::id get_id() const {
- return data_->th_.get_id();
- }
-
- shared_future<result_type>& get_future() {
- return data_->fut_;
- }
-};
-
-template <typename R>
-struct is_movable<shared_joiner<R> > : mpl::true_{};
-
-template <typename R>
-struct has_future_if<shared_joiner<R> > : mpl::true_{};
-
-template <typename R>
-struct has_thread_if<shared_joiner<R> > : mpl::true_{};
-
-
-class shared_threader {
-#ifdef BOOST_THREAD_HAS_THREAD_ATTR
-private:
- thread_specific_ptr<thread::native_handle_attr_type> attr_;
-public:
- thread::native_handle_attr_type& attr() {
- if(attr_.get() ==0) {
- attr_.reset(new thread::native_handle_attr_type());
- };
- return *attr_.get();
- }
-#endif
-
-public:
- template <typename T>
- struct handle {
- typedef shared_joiner<T> type;
- };
- template <typename F>
- 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
- return shared_joiner<result_type>(attr(), f);
-#else
- return shared_joiner<result_type>(f);
-#endif
- }
-
-
-
-};
-
-template <>
-struct get_future<shared_threader> {
- template <typename T>
- struct future_type {
- typedef shared_future<T> type;
- };
- template <typename T>
- shared_future<T>& operator()(shared_joiner<T>& j) { return j.get_future(); }
-};
-
-}
-#ifdef BOOST_HAS_RVALUE_REFS
- template <typename T>
- inline interthreads::unique_joiner<T>&& move(interthreads::unique_joiner<T>&& t)
- {
- return t;
- }
-#else
- template <typename T>
- inline boost::detail::thread_move_t<interthreads::unique_joiner<T> >
- move(boost::interthreads::unique_joiner<T>& t)
- {
- return boost::detail::thread_move_t<interthreads::unique_joiner<T> >(t);
- }
-#endif
-#ifdef BOOST_HAS_RVALUE_REFS
- template <typename T>
- inline interthreads::shared_joiner<T>&& move(interthreads::shared_joiner<T>&& t)
- {
- return t;
- }
-#else
- template <typename 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);
- }
-#endif
-}
-
-
-#include <boost/config/abi_suffix.hpp>
-
-#endif
-
Deleted: sandbox/interthreads/boost/interthreads/wait_for_all.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/wait_for_all.hpp 2009-05-02 10:08:54 EDT (Sat, 02 May 2009)
+++ (empty file)
@@ -1,147 +0,0 @@
-#ifndef BOOST_INTERTHREADS_WAIT_FOR_ALL__HPP
-#define BOOST_INTERTHREADS_WAIT_FOR_ALL__HPP
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// (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)
-//
-// See http://www.boost.org/libs/interthreads for documentation.
-//
-//////////////////////////////////////////////////////////////////////////////
-
-#include <boost/interthreads/fork_all.hpp>
-#include <boost/interthreads/algorithm/get_all.hpp>
-#include <boost/fusion/include/tuple.hpp>
-#include <boost/futures/future.hpp>
-#include <boost/utility/result_of.hpp>
-
-#include <boost/config/abi_prefix.hpp>
-
-
-namespace boost {
-namespace interthreads {
-
-namespace result_of {
- template <typename L, typename T>
- struct wait_for_all;
- template <typename L, typename F1>
- struct wait_for_all<L,fusion::tuple<F1> > {
- typedef fusion::tuple<
- typename boost::result_of<F1()>::type
- > type;
- };
- template <typename L, typename F1, typename F2>
- struct wait_for_all<L,fusion::tuple<F1,F2> > {
- typedef fusion::tuple<
- typename boost::result_of<F1()>::type,
- typename boost::result_of<F2()>::type
- > type;
- };
- template <typename L, typename F1, typename F2, typename F3>
- struct wait_for_all<L, fusion::tuple<F1,F2,F3> > {
- typedef fusion::tuple<
- typename boost::result_of<F1()>::type,
- typename boost::result_of<F2()>::type,
- typename boost::result_of<F3()>::type
- > type;
- };
- template <typename L, typename F1, typename F2, typename F3, typename F4>
- struct wait_for_all<L, fusion::tuple<F1,F2,F3,F4> > {
- typedef fusion::tuple<
- typename boost::result_of<F1()>::type,
- typename boost::result_of<F2()>::type,
- typename boost::result_of<F3()>::type,
- typename boost::result_of<F4()>::type
- > type;
- };
-
-}
-
-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>
-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
-}
-
-#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
-}
-template< typename AE, typename F1, typename F2, typename F3, typename F4>
-typename result_of::wait_for_all<AE, fusion::tuple<F1,F2,F3,F4> >::type
-wait_for_all( AE& ae, F1 f1, F2 f2 , F3 f3, F4 f4 ) {
- #if 1
- typename result_of::fork_all<AE, fusion::tuple<F1,F2,F3> >::type handles(fork_all(ae, f1, f2, f3, f4));
- 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, f3));
- 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, F4> >::type(
- fusion::at_c<0>(values), fusion::at_c<1>(values), fusion::at_c<2>(values), f4());
- #endif
-}
-
-}
-}
-
-
-#include <boost/config/abi_suffix.hpp>
-
-#endif
-
Deleted: sandbox/interthreads/boost/interthreads/wait_for_any.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/wait_for_any.hpp 2009-05-02 10:08:54 EDT (Sat, 02 May 2009)
+++ (empty file)
@@ -1,235 +0,0 @@
-#ifndef BOOST_INTERTHREADS_WAIT_FOR_ANY__HPP
-#define BOOST_INTERTHREADS_WAIT_FOR_ANY__HPP
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// (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.
-//
-//////////////////////////////////////////////////////////////////////////////
-
-#include <boost/interthreads/algorithm/interrupt_all.hpp>
-#include <boost/interthreads/algorithm/wait_all.hpp>
-#include <boost/interthreads/algorithm/get.hpp>
-#include <boost/interthreads/fork_all.hpp>
-#include <boost/fusion/include/tuple.hpp>
-#include <boost/futures/future.hpp>
-#include <boost/utility/result_of.hpp>
-#include <boost/type_traits/remove_reference.hpp>
-#include <exception>
-
-#include <boost/config/abi_prefix.hpp>
-
-
-namespace boost {
-namespace interthreads {
-
-namespace detail {
-
- template <typename T>
- struct pair_void {
- typedef std::pair<unsigned,T> type;
- typedef T value_type;
- };
- template <>
- struct pair_void<void> {
- typedef std::pair<unsigned,unsigned> type;
- typedef void value_type;
- };
-
- template <unsigned size, typename T>
- struct partial;
- template <typename P>
- struct partial<2,P> {
- typedef typename pair_void<P>::value_type T;
- typedef typename pair_void<P>::type type;
- template <typename H>
- static type make(unsigned r, H &handles) {
- return std::make_pair(r,get(r,handles));
- }
- template <typename H>
- static T get(unsigned r, H &handles) {
- switch (r) {
- case 0:
- return interthreads::get(fusion::at_c<0>(handles));
- case 1:
- return interthreads::get(fusion::at_c<1>(handles));
- default:
- throw std::range_error("");
- }
- }
- };
- template <typename P>
- struct partial<3,P> {
- typedef typename pair_void<P>::value_type T;
- typedef typename pair_void<P>::type type;
- template <typename H>
- static type make(unsigned r, H &handles) {
- return std::make_pair(r,get(r,handles));
- }
- template <typename H>
- static T get(unsigned r, H &handles) {
- switch (r) {
- case 0:
- return interthreads::get(fusion::at_c<0>(handles));
- case 1:
- return interthreads::get(fusion::at_c<1>(handles));
- case 2:
- return interthreads::get(fusion::at_c<2>(handles));
- default:
- throw std::range_error("");
- }
- }
- };
-
- struct partial_aux {
- typedef pair_void<void>::value_type T;
- typedef pair_void<void>::type type;
-
- template <typename H>
- static type make(unsigned i,H &h) {
- return std::make_pair(i,i);
- }
- };
-
- template <>
- struct partial<2, void > : partial_aux{};
-
- template <>
- struct partial<3, void > : partial_aux{};
-}
-
-namespace result_of {
- template <typename L, typename T>
- struct wait_for_any;
- template <typename L, typename F1, typename F2>
- struct wait_for_any<L, fusion::tuple<F1,F2> > {
- typedef typename detail::pair_void<typename boost::result_of<F1()>::type>::type type;
- };
- template <typename L, typename F1, typename F2, typename F3>
- 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>
-typename result_of::wait_for_any<AE, fusion::tuple<F1,F2> >::type
-wait_for_any( AE& ae, F1 f1, F2 f2 ) {
- typedef typename result_of::fork_all<AE, fusion::tuple<F1,F2> >::type handles_type;
- handles_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)));
- typename get_future<AE>::template future_type<
- typename act_traits< typename remove_reference<
- typename fusion::result_of::at_c<handles_type,0>::type
- >::type >::move_dest_type
- >::type fut0= get_future<AE>()(fusion::at_c<0>(handles));
- typename get_future<AE>::template future_type<
- typename act_traits< typename remove_reference<
- typename fusion::result_of::at_c<handles_type,1>::type
- >::type >::move_dest_type
- >::type fut1= get_future<AE>()(fusion::at_c<1>(handles));
- unsigned r = boost::wait_for_any(fut0, fut1);
- //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>
-typename result_of::wait_for_any<AE, fusion::tuple<F1,F2,F3> >::type
-wait_for_any( AE& ae, F1 f1, F2 f2 , F3 f3 ) {
- typedef typename result_of::fork_all<AE, fusion::tuple<F1,F2,F3> >::type handles_type;
- handles_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 get_future<AE>::template future_type<
- typename act_traits< typename remove_reference<
- typename fusion::result_of::at_c<handles_type,0>::type
- >::type >::move_dest_type
- >::type fut0= get_future<AE>()(fusion::at_c<0>(handles));
- typename get_future<AE>::template future_type<
- typename act_traits< typename remove_reference<
- typename fusion::result_of::at_c<handles_type,1>::type
- >::type >::move_dest_type
- >::type fut1= get_future<AE>()(fusion::at_c<1>(handles));
- typename get_future<AE>::template future_type<
- typename act_traits< typename remove_reference<
- typename fusion::result_of::at_c<handles_type,2>::type
- >::type >::move_dest_type
- >::type fut2= get_future<AE>()(fusion::at_c<2>(handles));
- unsigned r = boost::wait_for_any(fut0, fut1, fut2);
- 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>
-typename result_of::wait_for_any<AE, fusion::tuple<F1,F2> >::type
-wait_for_any_and_interrupt( AE& ae, F1 f1, F2 f2 ) {
- typedef typename result_of::fork_all<AE, fusion::tuple<F1,F2> >::type handles_type;
- handles_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)));
- typename get_future<AE>::template future_type<
- typename act_traits< typename remove_reference<
- typename fusion::result_of::at_c<handles_type,0>::type
- >::type >::move_dest_type
- >::type fut0= get_future<AE>()(fusion::at_c<0>(handles));
- typename get_future<AE>::template future_type<
- typename act_traits< typename remove_reference<
- typename fusion::result_of::at_c<handles_type,1>::type
- >::type >::move_dest_type
- >::type fut1= get_future<AE>()(fusion::at_c<1>(handles));
- unsigned r = boost::wait_for_any(fut0, fut1);
- 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);
- return res;
-}
-
-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 ) {
- typedef typename result_of::fork_all<AE, fusion::tuple<F1,F2,F3> >::type handles_type;
- handles_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 get_future<AE>::template future_type<
- typename act_traits< typename remove_reference<
- typename fusion::result_of::at_c<handles_type,0>::type
- >::type >::move_dest_type
- >::type fut0= get_future<AE>()(fusion::at_c<0>(handles));
- typename get_future<AE>::template future_type<
- typename act_traits< typename remove_reference<
- typename fusion::result_of::at_c<handles_type,1>::type
- >::type >::move_dest_type
- >::type fut1= get_future<AE>()(fusion::at_c<1>(handles));
- typename get_future<AE>::template future_type<
- typename act_traits< typename remove_reference<
- typename fusion::result_of::at_c<handles_type,2>::type
- >::type >::move_dest_type
- >::type fut2= get_future<AE>()(fusion::at_c<2>(handles));
- unsigned r = boost::wait_for_any(fut0, fut1, fut2);
- 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;
-}
-
-}
-}
-
-
-#include <boost/config/abi_suffix.hpp>
-
-#endif
-
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