Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r52482 - in sandbox/async: boost/async/algorithm boost/async/detail boost/async/typeof libs/async/doc libs/async/doc/images
From: vicente.botet_at_[hidden]
Date: 2009-04-19 05:41:43


Author: viboes
Date: 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
New Revision: 52482
URL: http://svn.boost.org/trac/boost/changeset/52482

Log:
Boost.Async V0.1: extraction from Boost.Intrethreads
Added:
   sandbox/async/boost/async/algorithm/
   sandbox/async/boost/async/algorithm/are_all_joinable.hpp (contents, props changed)
   sandbox/async/boost/async/algorithm/are_all_ready.hpp (contents, props changed)
   sandbox/async/boost/async/algorithm/detach.hpp (contents, props changed)
   sandbox/async/boost/async/algorithm/detach_all.hpp (contents, props changed)
   sandbox/async/boost/async/algorithm/get.hpp (contents, props changed)
   sandbox/async/boost/async/algorithm/get_all.hpp (contents, props changed)
   sandbox/async/boost/async/algorithm/get_all_until.hpp (contents, props changed)
   sandbox/async/boost/async/algorithm/get_until.hpp (contents, props changed)
   sandbox/async/boost/async/algorithm/has_exception.hpp (contents, props changed)
   sandbox/async/boost/async/algorithm/has_value.hpp (contents, props changed)
   sandbox/async/boost/async/algorithm/have_all_exception.hpp (contents, props changed)
   sandbox/async/boost/async/algorithm/have_all_value.hpp (contents, props changed)
   sandbox/async/boost/async/algorithm/interrupt.hpp (contents, props changed)
   sandbox/async/boost/async/algorithm/interrupt_all.hpp (contents, props changed)
   sandbox/async/boost/async/algorithm/interruption_requested.hpp (contents, props changed)
   sandbox/async/boost/async/algorithm/interruption_requested_on_all.hpp (contents, props changed)
   sandbox/async/boost/async/algorithm/is_ready.hpp (contents, props changed)
   sandbox/async/boost/async/algorithm/join.hpp (contents, props changed)
   sandbox/async/boost/async/algorithm/join_all.hpp (contents, props changed)
   sandbox/async/boost/async/algorithm/join_all_until.hpp (contents, props changed)
   sandbox/async/boost/async/algorithm/join_until.hpp (contents, props changed)
   sandbox/async/boost/async/algorithm/joinable.hpp (contents, props changed)
   sandbox/async/boost/async/algorithm/wait.hpp (contents, props changed)
   sandbox/async/boost/async/algorithm/wait_all.hpp (contents, props changed)
   sandbox/async/boost/async/algorithm/wait_all_until.hpp (contents, props changed)
   sandbox/async/boost/async/algorithm/wait_until.hpp (contents, props changed)
   sandbox/async/boost/async/detail/
   sandbox/async/boost/async/typeof/
   sandbox/async/boost/async/typeof/basic_threader.hpp (contents, props changed)
   sandbox/async/boost/async/typeof/future.hpp (contents, props changed)
   sandbox/async/boost/async/typeof/launcher.hpp (contents, props changed)
   sandbox/async/boost/async/typeof/scheduler.hpp (contents, props changed)
   sandbox/async/boost/async/typeof/threader.hpp (contents, props changed)
   sandbox/async/boost/async/typeof/threader_decorator.hpp (contents, props changed)
   sandbox/async/libs/async/doc/Jamfile.v2 (contents, props changed)
   sandbox/async/libs/async/doc/images/
   sandbox/async/libs/async/doc/images/fork.png (contents, props changed)
   sandbox/async/libs/async/doc/images/star.png (contents, props changed)
   sandbox/async/libs/async/doc/implementation.qbk (contents, props changed)
   sandbox/async/libs/async/doc/index.html (contents, props changed)
   sandbox/async/libs/async/doc/installation.qbk (contents, props changed)
   sandbox/async/libs/async/doc/introduction.qbk (contents, props changed)
   sandbox/async/libs/async/doc/models.qbk (contents, props changed)
   sandbox/async/libs/async/doc/overview.qbk (contents, props changed)
   sandbox/async/libs/async/doc/rationale.qbk (contents, props changed)
   sandbox/async/libs/async/doc/reference.qbk (contents, props changed)
   sandbox/async/libs/async/doc/tests.qbk (contents, props changed)
   sandbox/async/libs/async/doc/threade_joiner.qbk (contents, props changed)
   sandbox/async/libs/async/doc/tickets.qbk (contents, props changed)
   sandbox/async/libs/async/doc/tutorial.qbk (contents, props changed)
   sandbox/async/libs/async/doc/users_guide.qbk (contents, props changed)

Added: sandbox/async/boost/async/algorithm/are_all_joinable.hpp
==============================================================================
--- (empty file)
+++ sandbox/async/boost/async/algorithm/are_all_joinable.hpp 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,50 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/async for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ASYNC_INTERRUPTION_REQUESTED_ON_ALL__HPP
+#define BOOST_ASYNC_INTERRUPTION_REQUESTED_ON_ALL__HPP
+
+#include <boost/fusion/include/all.hpp>
+
+#include <boost/async/algorithm/joinable.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost { namespace async {
+
+ namespace fct {
+ struct joinable {
+ typedef bool result_type;
+
+ template<typename ACT>
+ bool operator()(ACT& act) const {
+ return async::joinable(act);
+ }
+ };
+ }
+
+ namespace result_of {
+ template <typename Sequence>
+ struct are_all_joinable {
+ typedef typename fusion::result_of::all<Sequence, fct::joinable>::type type;
+ };
+ }
+
+ template <typename Sequence>
+ bool are_all_joinable(Sequence& t) {
+ return fusion::all(t, joinable);
+ }
+
+
+}} // namespace boost
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif

Added: sandbox/async/boost/async/algorithm/are_all_ready.hpp
==============================================================================
--- (empty file)
+++ sandbox/async/boost/async/algorithm/are_all_ready.hpp 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,50 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/async for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ASYNC_ARE_ALL_READY__HPP
+#define BOOST_ASYNC_ARE_ALL_READY__HPP
+
+#include <boost/fusion/include/all.hpp>
+
+#include <boost/async/algorithm/is_ready.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace async {
+
+ namespace fct {
+ struct is_ready {
+ typedef bool result_type;
+
+ template<typename ACT>
+ bool operator()(ACT& act) const {
+ return async::is_ready(act);
+ }
+ };
+ }
+
+ namespace result_of {
+ template <typename Sequence> struct are_all_ready {
+ typedef typename fusion::result_of::all<Sequence, fct::is_ready>::type type;
+ };
+ }
+
+ template <typename Sequence> bool are_all_ready(Sequence& t) {
+ return fusion::all(t, fct::is_ready());
+ }
+
+
+}
+} // namespace boost
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif

Added: sandbox/async/boost/async/algorithm/detach.hpp
==============================================================================
--- (empty file)
+++ sandbox/async/boost/async/algorithm/detach.hpp 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,60 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/async for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ASYNC_DETACH__HPP
+#define BOOST_ASYNC_DETACH__HPP
+
+#include <boost/fusion/include/for_each.hpp>
+#include <boost/utility/enable_if.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace async {
+
+ namespace result_of {
+ template <typename ACT> struct detach {
+ typedef void type;
+ };
+ }
+
+ namespace partial_specialization_workaround {
+ template <typename ACT> struct detach {
+ static typename result_of::template detach<ACT>::type apply( ACT& act ) {
+ return act.detach();
+ }
+ };
+
+ template <typename ACT> struct detach<boost::detail::thread_move_t<ACT> > {
+ static typename result_of::template detach<ACT>::type apply( boost::detail::thread_move_t<ACT> act ) {
+ return act->detach();
+ }
+ };
+ }
+
+ template <typename ACT>
+ typename boost::enable_if<has_thread_if<ACT>,void>::type
+ detach(ACT& act) {
+ return partial_specialization_workaround::detach<ACT>::apply(act);
+ }
+
+ template <typename ACT>
+ typename boost::enable_if<has_thread_if<ACT>,void>::type
+ detach(boost::detail::thread_move_t<ACT> act) {
+ return partial_specialization_workaround::detach<boost::detail::thread_move_t<ACT> >::apply(act);
+ }
+
+
+}
+} // namespace boost
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif

Added: sandbox/async/boost/async/algorithm/detach_all.hpp
==============================================================================
--- (empty file)
+++ sandbox/async/boost/async/algorithm/detach_all.hpp 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,50 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/async for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ASYNC_DETACH_ALL__HPP
+#define BOOST_ASYNC_DETACH_ALL__HPP
+
+#include <boost/fusion/include/for_each.hpp>
+#include <boost/async/algorithm/detach.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace async {
+
+ namespace fct {
+ struct detach {
+ typedef void result_type;
+ template<typename ACT>
+ void operator()(ACT& act) const {
+ act.detach();
+ }
+ };
+ }
+
+ namespace result_of {
+ template <typename Sequence>
+ struct detach_all {
+ typedef typename fusion::result_of::for_each<Sequence, fct::detach>::type type;
+ };
+ }
+
+ template <typename Sequence>
+ void detach_all(Sequence& t) {
+ fusion::for_each(t, fct::detach());
+ }
+
+
+}
+} // namespace boost
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif

Added: sandbox/async/boost/async/algorithm/get.hpp
==============================================================================
--- (empty file)
+++ sandbox/async/boost/async/algorithm/get.hpp 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,71 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/async for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ASYNC_GET__HPP
+#define BOOST_ASYNC_GET__HPP
+
+#include <boost/fusion/include/for_each.hpp>
+#include <boost/fusion/include/zip_view.hpp>
+#include <boost/fusion/include/transform.hpp>
+#include <boost/fusion/include/as_vector.hpp>
+#include <boost/mpl/transform.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/utility/enable_if.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace async {
+
+ namespace result_of {
+ template <typename ACT> struct get {
+ typedef typename act_traits<ACT>::move_dest_type type;
+ };
+ template <typename ACT> struct get<boost::detail::thread_move_t<ACT> > {
+ typedef typename act_traits<ACT>::move_dest_type type;
+ };
+ }
+
+ namespace partial_specialization_workaround {
+ template <typename ACT> struct get {
+ static typename result_of::template get<ACT>::type apply( ACT& act ) {
+ return act.get();
+ }
+ };
+
+ template <typename ACT> struct get<boost::detail::thread_move_t<ACT> > {
+ static typename result_of::template get<ACT>::type apply( boost::detail::thread_move_t<ACT> act ) {
+ return act->get();
+ }
+ };
+ }
+
+ template <typename ACT>
+ typename boost::enable_if<has_future_if<ACT>,
+ typename result_of::template get<ACT>::type
+ >::type
+ get(ACT& act) {
+ return partial_specialization_workaround::get<ACT>::apply(act);
+ }
+
+ template <typename ACT>
+ typename boost::enable_if<has_future_if<ACT>,
+ typename result_of::template get<ACT>::type
+ >::type
+ get(boost::detail::thread_move_t<ACT> act) {
+ return partial_specialization_workaround::get<ACT>::apply(act);
+ }
+
+}
+} // namespace boost
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif

Added: sandbox/async/boost/async/algorithm/get_all.hpp
==============================================================================
--- (empty file)
+++ sandbox/async/boost/async/algorithm/get_all.hpp 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,175 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/async for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ASYNC_GET_ALL__HPP
+#define BOOST_ASYNC_GET_ALL__HPP
+
+#include <boost/fusion/include/for_each.hpp>
+#include <boost/fusion/include/zip_view.hpp>
+#include <boost/fusion/include/transform.hpp>
+#include <boost/fusion/include/as_vector.hpp>
+#include <boost/mpl/transform.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/type_traits/remove_const.hpp>
+
+#include <boost/async/algorithm/get.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace async {
+ namespace fct {
+ struct get {
+ template <typename Sig>
+ struct result;
+
+ template <typename T>
+ struct result<get(T)>
+ {
+ typedef typename boost::remove_const<typename boost::remove_reference<T>::type>::type ACT;
+ typedef typename act_traits<ACT>::move_dest_type type;
+ };
+
+ template <typename ACT>
+ typename ACT::result_type operator()(ACT& act) const {
+ return typename ACT::result_type();
+ }
+ };
+
+ struct set {
+ template<typename Sig>
+ struct result;
+
+ template<typename T>
+ struct result<set(T)>
+ {
+ typedef void type;
+ };
+
+ template<typename ACT_VAL>
+ void operator()(ACT_VAL act_val) const {
+ fusion::at_c<1>(act_val)=async::get(fusion::at_c<0>(act_val));
+ }
+ };
+ }
+
+ namespace result_of {
+ template <typename Sequence>
+ struct set_all {
+ typedef void type;
+ };
+
+ template <typename Sequence>
+ struct get_all {
+ typedef typename fusion::result_of::as_vector<
+ typename fusion::result_of::transform<Sequence const, fct::get>::type
+ >::type type;
+ };
+ }
+
+ template <typename SequenceHandles, typename SequenceValues>
+ void set_all(SequenceHandles& handles, SequenceValues& values) {
+ typedef fusion::vector<SequenceHandles&, SequenceValues&> sequences;
+ sequences seqs(handles, values);
+ fusion::zip_view<sequences> zip(seqs);
+ fusion::for_each(zip, fct::set());
+ }
+
+#if 0
+namespace detail {
+ template<int N>
+ struct get_all_unrolled
+ {
+ template<typename I0>
+ static void call(I0& i0)
+ {
+ fct::get()(*i0);
+ typedef typename fusion::result_of::next<I0>::type I1;
+ I1 i1(fusion::next(i0));
+ fct::get()(*i1);
+ typedef typename fusion::result_of::next<I1>::type I2;
+ I2 i2(fusion::next(i1));
+ fct::get()(*i2);
+ typedef typename fusion::result_of::next<I2>::type I3;
+ I3 i3(fusion::next(i2));
+ fct::get()(*i3);
+ return get_all_unrolled<N-4>::call(fusion::next(i3), abs_time);
+ }
+ };
+
+ template<>
+ struct get_all_unrolled<3>
+ {
+ template<typename I0>
+ static bool call(I0& i0)
+ {
+ }
+ };
+
+ template<>
+ struct get_all_unrolled<2>
+ {
+ template<typename I0>
+ static bool call(I0& i0)
+ {
+ }
+ };
+
+ template<>
+ struct get_all_unrolled<1>
+ {
+ template<typename I0>
+ static bool call(I0& i0)
+ {
+ return fct::get()(*i0);
+ }
+ };
+
+ template<>
+ struct get_all_unrolled<0>
+ {
+ template<typename It>
+ static bool call(It const&, const system_time&)
+ {
+ return true;
+ }
+ };
+
+ template <typename Sequence>
+ inline typename result_of::template get_all<Sequence>::type
+ get_all(Sequence& seq, const system_time& abs_time, fusion::random_access_traversal_tag)
+ {
+ typedef typename fusion::result_of::begin<Sequence>::type begin;
+ typedef typename fusion::result_of::end<Sequence>::type end;
+ return get_all_unrolled<fusion::result_of::distance<begin, end>::type::value>::call(fusion::begin(seq), abs_time);
+ }
+
+
+}
+#endif
+
+ template <typename Sequence>
+ typename result_of::template get_all<Sequence>::type
+ get_all(Sequence& seq) {
+#if 0
+ return detail::get_all(seq, abs_time, typename fusion::traits::category_of<Sequence>::type());
+#else
+ typename result_of::template get_all<Sequence>::type res=fusion::as_vector(fusion::transform(seq, fct::get()));
+ set_all(seq, res);
+ return res;
+#endif
+ }
+
+}
+} // namespace boost
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif

Added: sandbox/async/boost/async/algorithm/get_all_until.hpp
==============================================================================
--- (empty file)
+++ sandbox/async/boost/async/algorithm/get_all_until.hpp 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,100 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/async for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ASYNC_GET_ALL_UNTIL__HPP
+#define BOOST_ASYNC_GET_ALL_UNTIL__HPP
+
+#include <boost/fusion/include/transform.hpp>
+#include <boost/fusion/include/size.hpp>
+#include <boost/fusion/include/at_c.hpp>
+#include <boost/fusion/include/pop_front.hpp>
+#include <boost/fusion/include/push_front.hpp>
+#include <utility>
+
+#ifdef BOOST_HAS_CHRONO_LIB
+#include <boost/chrono/chrono.hpp>
+#else
+#include <boost/thread/thread_time.hpp>
+#endif
+#include <boost/async/algorithm/get_until.hpp>
+//#include <boost/async/algorithm/get_all.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace async {
+
+ namespace fct {
+ struct get_until {
+ get_until(const system_time& abs_time) : abs_time_(abs_time) {}
+ template<typename ACT>
+ typename std::pair<bool,typename ACT::result_type> operator()(ACT& act) const {
+ return async::get_until(act, abs_time_);
+ }
+ private:
+ const system_time& abs_time_;
+ };
+ }
+
+ namespace fct {
+ struct get_for {
+ template <typename Duration>
+ get_for(const Duration& abs_time) : abs_time_(get_system_time()+abs_time) {}
+ template<typename ACT>
+ typename std::pair<bool,typename ACT::result_type> operator()(ACT& act) const {
+ return async::get_until(act, abs_time_);
+ }
+ private:
+ const system_time& abs_time_;
+ };
+ }
+
+ namespace result_of {
+ template <typename Sequence>
+ struct get_all_until {
+ typedef std::pair<bool, typename result_of::get_all<Sequence>::type > type;
+ };
+ }
+
+ namespace result_of {
+ template <typename Sequence>
+ struct get_all_for {
+ typedef std::pair<bool, typename result_of::get_all<Sequence>::type > type;
+ };
+ }
+
+ template <typename Sequence>
+ typename result_of::template get_all_until<Sequence>::type
+ get_all_until(Sequence& t, const system_time& abs_time) {
+ std::pair<bool,typename fusion::result_of::at_c<Sequence, 0>::type::result_type > r = fct::get_until(abs_time)(fusion::at_c<0>(t));
+ if (r.first) return std::make_pair(true, result_of::get_all<Sequence>::type());
+ else {
+ if (fusion::size(t)==1) {
+ return std::make_pair(false, result_of::get_all<Sequence>::type(r.first));
+ } else {
+ typename result_of::get_all_until<typename fusion::result_of::pop_front<Sequence>::type > tmp= get_all_until(fusion::pop_front(t));
+ return std::make_pair(tmp.first, fusion::push_front(tmp.second, r.second));
+ }
+ }
+ }
+
+ template <typename Sequence, typename Duration>
+ typename result_of::template get_all_for<Sequence>::type
+ get_all_for(Sequence& t, Duration rel_time) {
+ return get_all_until(t, get_system_time()+rel_time);
+ }
+
+
+}
+} // namespace boost
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif

Added: sandbox/async/boost/async/algorithm/get_until.hpp
==============================================================================
--- (empty file)
+++ sandbox/async/boost/async/algorithm/get_until.hpp 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,85 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/async for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ASYNC_GET_UNTIL__HPP
+#define BOOST_ASYNC_GET_UNTIL__HPP
+
+#include <boost/fusion/include/transform.hpp>
+#include <boost/fusion/include/size.hpp>
+#include <boost/fusion/include/at_c.hpp>
+#include <boost/fusion/include/pop_front.hpp>
+#include <boost/fusion/include/push_front.hpp>
+#include <utility>
+#include <boost/utility/enable_if.hpp>
+
+#ifdef BOOST_HAS_CHRONO_LIB
+#include <boost/chrono/chrono.hpp>
+#else
+#include <boost/thread/thread_time.hpp>
+#endif
+#include <boost/async/algorithm/wait_until.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace async {
+
+ namespace result_of {
+ template <typename ACT>
+ struct get_until {
+ typedef typename act_traits<ACT>::move_dest_type type;
+ };
+ }
+
+ namespace result_of {
+ template <typename ACT, typename Duration>
+ struct get_for {
+ typedef typename act_traits<ACT>::move_dest_type type;
+ };
+ }
+
+ namespace partial_specialization_workaround {
+ template< typename ACT >
+ struct get_until {
+ static typename result_of::template get_until<ACT>::type apply( ACT& act, const system_time& abs_time ) {
+ async::wait_until(act, abs_time);
+ return act.get();
+ }
+ };
+ template< typename ACT, typename Duration>
+ struct get_for {
+ static typename result_of::template get_for<ACT,Duration>::type apply( ACT& act, Duration rel_time ) {
+ async::wait_for(act, rel_time);
+ return act.get();
+ }
+ };
+ }
+
+
+ template <typename ACT>
+ typename boost::enable_if<has_future_if<ACT>,
+ typename result_of::template get_until<ACT>::type
+ >::type get_until(ACT& act, const system_time& abs_time) {
+ return partial_specialization_workaround::get_until<ACT>::apply(act, abs_time);
+ }
+
+ template <typename ACT, typename Duration>
+ typename boost::enable_if<has_future_if<ACT>,typename result_of::template get_for<ACT,Duration>::type >::type
+ get_for(ACT& act, Duration rel_time) {
+ return partial_specialization_workaround::get_for<ACT, Duration>::apply(act, rel_time);
+ }
+
+
+}
+} // namespace boost
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif

Added: sandbox/async/boost/async/algorithm/has_exception.hpp
==============================================================================
--- (empty file)
+++ sandbox/async/boost/async/algorithm/has_exception.hpp 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,48 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/async for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ASYNC_HAS_EXCEPTION__HPP
+#define BOOST_ASYNC_HAS_EXCEPTION__HPP
+
+#include <boost/fusion/include/all.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace async {
+
+ namespace result_of {
+ template <typename ACT> struct has_exception {
+ typedef bool type;
+ };
+ }
+
+ namespace partial_specialization_workaround {
+ template <typename ACT> struct has_exception {
+ static typename result_of::has_exception<ACT>::type apply( ACT& act ) {
+ return act.has_exception();
+ }
+ };
+ }
+
+ template <typename ACT>
+ typename boost::enable_if<has_future_if<ACT>,
+ typename result_of::template is_ready<ACT>::type
+ >::type has_exception(ACT& act) {
+ return partial_specialization_workaround::has_exception<ACT>::apply(act);
+ }
+
+
+}
+} // namespace boost
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif

Added: sandbox/async/boost/async/algorithm/has_value.hpp
==============================================================================
--- (empty file)
+++ sandbox/async/boost/async/algorithm/has_value.hpp 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,48 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/async for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ASYNC_HAS_VALUE__HPP
+#define BOOST_ASYNC_HAS_VALUE__HPP
+
+#include <boost/fusion/include/all.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace async {
+
+ namespace result_of {
+ template <typename ACT> struct has_value {
+ typedef bool type;
+ };
+ }
+
+ namespace partial_specialization_workaround {
+ template <typename ACT> struct has_value {
+ static typename result_of::has_value<ACT>::type apply( ACT& act ) {
+ return act.has_value();
+ }
+ };
+ }
+
+ template <typename ACT>
+ typename boost::enable_if<has_future_if<ACT>,
+ typename result_of::template is_ready<ACT>::type
+ >::type has_value(ACT& act) {
+ return partial_specialization_workaround::has_value<ACT>::apply(act);
+ }
+
+
+}
+} // namespace boost
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif

Added: sandbox/async/boost/async/algorithm/have_all_exception.hpp
==============================================================================
--- (empty file)
+++ sandbox/async/boost/async/algorithm/have_all_exception.hpp 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,49 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/async for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ASYNC_HAVE_ALL_EXCEPTION__HPP
+#define BOOST_ASYNC_HAVE_ALL_EXCEPTION__HPP
+
+#include <boost/fusion/include/all.hpp>
+
+#include <boost/async/algorithm/has_exception.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost { namespace async {
+
+ namespace fct {
+ struct has_exception {
+ typedef bool result_type;
+
+ template<typename ACT>
+ bool operator()(ACT& act) const {
+ return async::has_exception(act);
+ }
+ };
+ }
+
+ namespace result_of {
+ template <typename Sequence> struct have_all_exception {
+ typedef typename fusion::result_of::all<Sequence, fct::has_exception>::type type;
+ };
+ }
+
+ template <typename Sequence> bool have_all_exception(Sequence& t) {
+ return fusion::all(t, fct::has_exception());
+ }
+
+
+}
+} // namespace boost
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif

Added: sandbox/async/boost/async/algorithm/have_all_value.hpp
==============================================================================
--- (empty file)
+++ sandbox/async/boost/async/algorithm/have_all_value.hpp 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,49 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/async for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ASYNC_HAVE_ALL_VALUE__HPP
+#define BOOST_ASYNC_HAVE_ALL_VALUE__HPP
+
+#include <boost/fusion/include/all.hpp>
+
+#include <boost/async/algorithm/has_value.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace async {
+
+ namespace fct {
+ struct has_value {
+ typedef bool result_type;
+
+ template<typename ACT> bool operator()(ACT& act) const {
+ return async::has_value(act);
+ }
+ };
+ }
+
+ namespace result_of {
+ template <typename Sequence> struct have_all_value {
+ typedef typename fusion::result_of::all<Sequence, fct::has_value>::type type;
+ };
+ }
+
+ template <typename Sequence> bool have_all_value(Sequence& t) {
+ return fusion::all(t, fct::has_value());
+ }
+
+
+}
+} // namespace boost
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif

Added: sandbox/async/boost/async/algorithm/interrupt.hpp
==============================================================================
--- (empty file)
+++ sandbox/async/boost/async/algorithm/interrupt.hpp 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,65 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/async for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ASYNC_INTERRUPT__HPP
+#define BOOST_ASYNC_INTERRUPT__HPP
+
+#include <boost/fusion/include/for_each.hpp>
+#include <boost/utility/enable_if.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace async {
+
+ namespace result_of {
+ template <typename ACT>
+ struct interrupt {
+ typedef void type;
+ };
+ }
+
+ namespace partial_specialization_workaround {
+ template< typename ACT >
+ struct interrupt {
+ static typename result_of::template interrupt<ACT>::type apply( ACT& act ) {
+ return act.interrupt();
+ }
+ };
+ template< typename ACT >
+ struct interrupt<boost::detail::thread_move_t<ACT> > {
+ static typename result_of::template interrupt<ACT>::type apply( boost::detail::thread_move_t<ACT> act ) {
+ return act->interrupt();
+ }
+ };
+ }
+
+ template <typename ACT>
+ typename boost::enable_if<has_thread_if<ACT>,
+ void
+ >::type
+ interrupt(ACT& act) {
+ return partial_specialization_workaround::interrupt<ACT>::apply(act);
+ }
+
+ template <typename ACT>
+ typename boost::enable_if<has_thread_if<ACT>,
+ void
+ >::type
+ interrupt(boost::detail::thread_move_t<ACT> act) {
+ return partial_specialization_workaround::interrupt<boost::detail::thread_move_t<ACT> >::apply(act);
+ }
+
+}
+} // namespace boost
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif

Added: sandbox/async/boost/async/algorithm/interrupt_all.hpp
==============================================================================
--- (empty file)
+++ sandbox/async/boost/async/algorithm/interrupt_all.hpp 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,49 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/async for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ASYNC_INTERRUPT_ALL__HPP
+#define BOOST_ASYNC_INTERRUPT_ALL__HPP
+
+#include <boost/fusion/include/for_each.hpp>
+#include <boost/async/algorithm/interrupt.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace async {
+
+ namespace fct {
+ struct interrupt {
+ template<typename ACT>
+ void operator()(ACT& act) const {
+ //std::cout << "interrupt_all::interrupt" << std::endl;
+ async::interrupt(act);
+ }
+ };
+ }
+
+ namespace result_of {
+ template <typename Sequence>
+ struct interrupt_all {
+ typedef typename fusion::result_of::for_each<Sequence, fct::interrupt>::type type;
+ };
+ }
+
+ template <typename Sequence>
+ void interrupt_all(Sequence& t) {
+ fusion::for_each(t, fct::interrupt());
+ }
+
+}
+} // namespace boost
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif

Added: sandbox/async/boost/async/algorithm/interruption_requested.hpp
==============================================================================
--- (empty file)
+++ sandbox/async/boost/async/algorithm/interruption_requested.hpp 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,65 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/async for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ASYNC_INTERRUPTION_REQUESTED__HPP
+#define BOOST_ASYNC_INTERRUPTION_REQUESTED__HPP
+
+#include <boost/fusion/include/all.hpp>
+#include <boost/utility/enable_if.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+ namespace boost {
+ namespace async {
+
+ namespace result_of {
+ template <typename ACT>
+ struct interruption_requested {
+ typedef bool type;
+ };
+ }
+
+ namespace partial_specialization_workaround {
+ template< typename ACT >
+ struct interruption_requested {
+ static typename result_of::template interruption_requested<ACT>::type apply( ACT& act ) {
+ return act.interruption_requested();
+ }
+ };
+ template< typename ACT >
+ struct interruption_requested<boost::detail::thread_move_t<ACT> > {
+ static typename result_of::template interruption_requested<ACT>::type apply( boost::detail::thread_move_t<ACT> act ) {
+ return act->interruption_requested();
+ }
+ };
+ }
+
+ template <typename ACT>
+ typename boost::enable_if<has_thread_if<ACT>,
+ bool
+ >::type
+ interruption_requested(ACT& act) {
+ return partial_specialization_workaround::interruption_requested<ACT>::apply(act);
+ }
+
+ template <typename ACT>
+ typename boost::enable_if<has_thread_if<ACT>,
+ bool
+ >::type
+ interruption_requested(boost::detail::thread_move_t<ACT> act) {
+ return partial_specialization_workaround::interruption_requested<boost::detail::thread_move_t<ACT> >::apply(act);
+ }
+
+}
+} // namespace boost
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif

Added: sandbox/async/boost/async/algorithm/interruption_requested_on_all.hpp
==============================================================================
--- (empty file)
+++ sandbox/async/boost/async/algorithm/interruption_requested_on_all.hpp 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,50 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/async for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ASYNC_INTERRUPTION_REQUESTED_ON_ALL__HPP
+#define BOOST_ASYNC_INTERRUPTION_REQUESTED_ON_ALL__HPP
+
+#include <boost/fusion/include/all.hpp>
+
+#include <boost/async/algorithm/interruption_requested.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost { namespace async {
+
+ namespace fct {
+ struct interruption_requested {
+ typedef bool result_type;
+
+ template<typename ACT>
+ bool operator()(ACT& act) const {
+ return async::interruption_requested(act);
+ }
+ };
+ }
+
+ namespace result_of {
+ template <typename Sequence>
+ struct interruption_requested_on_all {
+ typedef typename fusion::result_of::all<Sequence, fct::interruption_requested>::type type;
+ };
+ }
+
+ template <typename Sequence>
+ bool interruption_requested_on_all(Sequence& t) {
+ return fusion::all(t, fct::interruption_requested());
+ }
+
+
+}} // namespace boost
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif

Added: sandbox/async/boost/async/algorithm/is_ready.hpp
==============================================================================
--- (empty file)
+++ sandbox/async/boost/async/algorithm/is_ready.hpp 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,48 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/async for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ASYNC_IS_READY__HPP
+#define BOOST_ASYNC_IS_READY__HPP
+
+#include <boost/fusion/include/all.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace async {
+
+ namespace result_of {
+ template <typename ACT> struct is_ready {
+ typedef bool type;
+ };
+ }
+
+ namespace partial_specialization_workaround {
+ template <typename ACT> struct is_ready {
+ static typename result_of::is_ready<ACT>::type apply( ACT& act ) {
+ return act.is_ready();
+ }
+ };
+ }
+
+ template <typename ACT>
+ typename boost::enable_if<has_future_if<ACT>,
+ typename result_of::template is_ready<ACT>::type
+ >::type is_ready(ACT& act) {
+ return partial_specialization_workaround::is_ready<ACT>::apply(act);
+ }
+
+
+}
+} // namespace boost
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif

Added: sandbox/async/boost/async/algorithm/join.hpp
==============================================================================
--- (empty file)
+++ sandbox/async/boost/async/algorithm/join.hpp 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,71 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/async for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ASYNC_JOIN__HPP
+#define BOOST_ASYNC_JOIN__HPP
+
+#include <boost/fusion/include/for_each.hpp>
+#include <boost/utility/enable_if.hpp>
+
+#ifdef BOOST_HAS_CHRONO_LIB
+#include <boost/chrono/chrono.hpp>
+#else
+#include <boost/thread/thread_time.hpp>
+#endif
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace async {
+
+ namespace result_of {
+ template <typename ACT>
+ struct join {
+ typedef void type;
+ };
+ }
+
+ namespace partial_specialization_workaround {
+ template< typename ACT >
+ struct join {
+ static typename result_of::template join<ACT>::type apply( ACT& act ) {
+ return act.join();
+ }
+ };
+ template< typename ACT >
+ struct join<boost::detail::thread_move_t<ACT> > {
+ static typename result_of::template join<ACT>::type apply( boost::detail::thread_move_t<ACT> act ) {
+ return act->join();
+ }
+ };
+ }
+
+ template <typename ACT>
+ typename boost::enable_if<has_thread_if<ACT>,
+ typename result_of::template join<ACT>::type
+ >::type
+ join(ACT& act) {
+ return partial_specialization_workaround::join<ACT>::apply(act);
+ }
+
+ template <typename ACT>
+ typename boost::enable_if<has_thread_if<ACT>,
+ typename result_of::template join<ACT>::type
+ >::type
+ join(boost::detail::thread_move_t<ACT> act) {
+ return partial_specialization_workaround::join<boost::detail::thread_move_t<ACT> >::apply(act);
+ }
+
+}
+} // namespace boost
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif

Added: sandbox/async/boost/async/algorithm/join_all.hpp
==============================================================================
--- (empty file)
+++ sandbox/async/boost/async/algorithm/join_all.hpp 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,57 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/async for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ASYNC_JOIN_ALL__HPP
+#define BOOST_ASYNC_JOIN_ALL__HPP
+
+#include <boost/fusion/include/for_each.hpp>
+
+#ifdef BOOST_HAS_CHRONO_LIB
+#include <boost/chrono/chrono.hpp>
+#else
+#include <boost/thread/thread_time.hpp>
+#endif
+
+#include <boost/async/algorithm/join.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace async {
+
+ namespace fct {
+ struct join {
+ typedef void result_type;
+ template<typename ACT>
+ void operator()(ACT& act) const {
+ async::join(act);
+ }
+ };
+ }
+
+ namespace result_of {
+ template <typename Sequence>
+ struct join_all {
+ typedef typename fusion::result_of::for_each<Sequence, fct::join>::type type;
+ };
+ }
+
+ template <typename Sequence>
+ typename result_of::join_all<Sequence>::type
+ join_all(Sequence& t) {
+ return fusion::for_each(t, fct::join());
+ }
+
+}
+} // namespace boost
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif

Added: sandbox/async/boost/async/algorithm/join_all_until.hpp
==============================================================================
--- (empty file)
+++ sandbox/async/boost/async/algorithm/join_all_until.hpp 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,192 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/async for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ASYNC_JOIN_ALL_UNTIL__HPP
+#define BOOST_ASYNC_JOIN_ALL_UNTIL__HPP
+
+#include <boost/fusion/include/transform.hpp>
+
+#ifdef BOOST_HAS_CHRONO_LIB
+#include <boost/chrono/chrono.hpp>
+#else
+#include <boost/thread/thread_time.hpp>
+#endif
+#include <boost/async/algorithm/join_until.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace async {
+
+ namespace fct {
+ struct join_until {
+ join_until(const system_time& abs_time) : abs_time_(abs_time) {}
+ template<typename ACT>
+ bool operator()(ACT& act) const {
+ return async::join_until(act, abs_time_);
+ }
+ private:
+ const system_time& abs_time_;
+ };
+ }
+
+ namespace fct {
+ struct join_for {
+ template <typename Duration>
+ join_for(const Duration& rel_time) : abs_time_(get_system_time()+rel_time) {}
+ template<typename ACT>
+ bool operator()(ACT& act) const {
+ return join_until(act, abs_time_);
+ }
+ private:
+ const system_time& abs_time_;
+ };
+ }
+
+ namespace result_of {
+ template <typename Sequence>
+ struct join_all_until {
+ typedef bool type;
+ };
+ }
+ namespace result_of {
+ template <typename Sequence>
+ struct join_all_for {
+ typedef bool type;
+ };
+ }
+
+namespace detail {
+ template<int N>
+ struct join_all_until_unrolled
+ {
+ template<typename I0>
+ static bool call(I0 const& i0, const system_time& abs_time)
+ {
+ if (fct::join_until(abs_time)(*i0)) return true;
+ else {
+ typedef typename fusion::result_of::next<I0>::type I1;
+ I1 i1(fusion::next(i0));
+ if(fct::join_until(abs_time)(*i1)) return true;
+ else {
+ typedef typename fusion::result_of::next<I1>::type I2;
+ I2 i2(fusion::next(i1));
+ if(fct::join_until(abs_time)(*i2)) return true;
+ else {
+ typedef typename fusion::result_of::next<I2>::type I3;
+ I3 i3(fusion::next(i2));
+ if(fct::join_until(abs_time)(*i3)) return true;
+ else {
+ return join_all_until_unrolled<N-4>::call(fusion::next(i3), abs_time);
+ }
+ }
+ }
+ }
+ }
+ };
+
+ template<>
+ struct join_all_until_unrolled<3>
+ {
+ template<typename I0>
+ static bool call(I0 const& i0, const system_time& abs_time)
+ {
+ if (fct::join_until(abs_time)(*i0)) return true;
+ else {
+ typedef typename fusion::result_of::next<I0>::type I1;
+ I1 i1(fusion::next(i0));
+ if(fct::join_until(abs_time)(*i1)) return true;
+ else {
+ typedef typename fusion::result_of::next<I1>::type I2;
+ I2 i2(fusion::next(i1));
+ return fct::join_until(abs_time)(*i2);
+ }
+ }
+ }
+ };
+
+ template<>
+ struct join_all_until_unrolled<2>
+ {
+ template<typename I0>
+ static bool call(I0 const& i0, const system_time& abs_time)
+ {
+ if (fct::join_until(abs_time)(*i0)) return true;
+ else {
+ typedef typename fusion::result_of::next<I0>::type I1;
+ I1 i1(fusion::next(i0));
+ return fct::join_until(abs_time)(*i1);
+ }
+ }
+ };
+
+ template<>
+ struct join_all_until_unrolled<1>
+ {
+ template<typename I0>
+ static bool call(I0 const& i0, const system_time& abs_time)
+ {
+ return fct::join_until(abs_time)(*i0);
+ }
+ };
+
+ template<>
+ struct join_all_until_unrolled<0>
+ {
+ template<typename It>
+ static bool call(It const&, const system_time&)
+ {
+ return true;
+ }
+ };
+
+ template <typename Sequence>
+ inline typename result_of::template join_all_until<Sequence>::type
+ join_all_until(Sequence& seq, const system_time& abs_time, fusion::random_access_traversal_tag)
+ {
+ typedef typename fusion::result_of::begin<Sequence>::type begin;
+ typedef typename fusion::result_of::end<Sequence>::type end;
+ return join_all_until_unrolled<fusion::result_of::distance<begin, end>::type::value>::call(fusion::begin(seq), abs_time);
+ }
+
+
+}
+
+
+ template <typename Sequence>
+ typename result_of::template join_all_until<Sequence>::type
+ join_all_until(Sequence& seq, const system_time& abs_time) {
+#if 1
+ return detail::join_all_until(seq, abs_time, typename fusion::traits::category_of<Sequence>::type());
+#else
+ bool r = fct::join_until(abs_time)(fusion::at_c<0>(t));
+ if (r) return true;
+ else {
+ if (fusion::size(t)==1) {
+ return false;
+ } else {
+ return join_all_until(fusion::pop_front(t), abs_time);
+ }
+ }
+#endif
+ }
+
+ template <typename Sequence, typename Duration>
+ typename result_of::template join_all_for<Sequence>::type
+ join_all_for(Sequence& seq, Duration rel_time) {
+ return join_all_until(seq, get_system_time()+rel_time);
+ }
+
+}
+} // namespace boost
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif

Added: sandbox/async/boost/async/algorithm/join_until.hpp
==============================================================================
--- (empty file)
+++ sandbox/async/boost/async/algorithm/join_until.hpp 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,108 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/async for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ASYNC_JOIN_UNTIL__HPP
+#define BOOST_ASYNC_JOIN_UNTIL__HPP
+
+#include <boost/fusion/include/transform.hpp>
+#include <boost/utility/enable_if.hpp>
+
+#ifdef BOOST_HAS_CHRONO_LIB
+#include <boost/chrono/chrono.hpp>
+#else
+#include <boost/thread/thread_time.hpp>
+#endif
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace async {
+
+ namespace result_of {
+ template <typename ACT>
+ struct join_until {
+ typedef bool type;
+ };
+ }
+ namespace result_of {
+ template <typename ACT, typename Duration>
+ struct join_for {
+ typedef bool type;
+ };
+ }
+
+ namespace partial_specialization_workaround {
+ template< typename ACT >
+ struct join_until {
+ static typename result_of::template join_until<ACT>::type apply( ACT& act, const system_time& abs_time ) {
+ return act.join_until(abs_time);
+ }
+ };
+
+ template< typename ACT >
+ struct join_until<boost::detail::thread_move_t<ACT> > {
+ static typename result_of::template join_until<ACT>::type apply( boost::detail::thread_move_t<ACT> act, const system_time& abs_time ) {
+ return act->join_until(abs_time);
+ }
+ };
+
+ template< typename ACT, typename Duration>
+ struct join_for {
+ static typename result_of::template join_for<ACT,Duration>::type apply( ACT& act, Duration abs_time ) {
+ return act.join_for(abs_time);
+ }
+ };
+
+ template< typename ACT, typename Duration>
+ struct join_for<boost::detail::thread_move_t<ACT>,Duration > {
+ static typename result_of::template join_for<ACT,Duration>::type apply( boost::detail::thread_move_t<ACT> act, Duration abs_time ) {
+ return act->join_for(abs_time);
+ }
+ };
+ }
+
+ template <typename ACT>
+ typename boost::enable_if<has_thread_if<ACT>,
+ typename result_of::template join_until<ACT>::type
+ >::type
+ join_until(ACT& act, const system_time& abs_time) {
+ return partial_specialization_workaround::join_until<ACT>::apply(act, abs_time);
+ }
+
+ template <typename ACT>
+ typename boost::enable_if<has_thread_if<ACT>,
+ typename result_of::template join_until<ACT>::type
+ >::type
+ join_until(boost::detail::thread_move_t<ACT> act, const system_time& abs_time) {
+ return partial_specialization_workaround::join_until<boost::detail::thread_move_t<ACT> >::apply(act, abs_time);
+ }
+
+ template <typename ACT, typename Duration>
+ typename boost::enable_if<has_thread_if<ACT>,
+ typename result_of::template join_for<ACT,Duration>::type
+ >::type
+ join_for(ACT& act, const Duration& rel_time) {
+ return partial_specialization_workaround::join_for<ACT,Duration>::apply(act, rel_time);
+ }
+
+ template <typename ACT, typename Duration>
+ typename boost::enable_if<has_thread_if<ACT>,
+ typename result_of::template join_for<ACT,Duration>::type
+ >::type
+ join_for(boost::detail::thread_move_t<ACT> act, const Duration& rel_time) {
+ return partial_specialization_workaround::join_for<boost::detail::thread_move_t<ACT>,Duration>::apply(act, rel_time);
+ }
+
+}
+} // namespace boost
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif

Added: sandbox/async/boost/async/algorithm/joinable.hpp
==============================================================================
--- (empty file)
+++ sandbox/async/boost/async/algorithm/joinable.hpp 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,61 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/async for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ASYNC_JOINABLE__HPP
+#define BOOST_ASYNC_JOINABLE__HPP
+
+#include <boost/fusion/include/all.hpp>
+#include <boost/utility/enable_if.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace async {
+
+ namespace result_of {
+ template <typename ACT>
+ struct joinable {
+ typedef bool type;
+ };
+ }
+
+ namespace partial_specialization_workaround {
+ template <typename ACT> struct joinable {
+ static typename result_of::template joinable<ACT>::type apply( ACT& act ) {
+ return act.joinable();
+ }
+ };
+ template <typename ACT> struct joinable<boost::detail::thread_move_t<ACT> >{
+ static typename result_of::template joinable<ACT>::type apply( boost::detail::thread_move_t<ACT> act ) {
+ return act->joinable();
+ }
+ };
+ }
+
+ template <typename ACT>
+ typename boost::enable_if<has_thread_if<ACT>,
+ typename result_of::template joinable<ACT>::type
+ >::type joinable(ACT& act) {
+ return partial_specialization_workaround::joinable<ACT>::apply(act);
+ }
+
+ template <typename ACT>
+ typename boost::enable_if<has_thread_if<ACT>,
+ typename result_of::template joinable<ACT>::type
+ >::type joinable(boost::detail::thread_move_t<ACT> act) {
+ return partial_specialization_workaround::joinable<boost::detail::thread_move_t<ACT> >::apply(act);
+ }
+
+}
+} // namespace boost
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif

Added: sandbox/async/boost/async/algorithm/wait.hpp
==============================================================================
--- (empty file)
+++ sandbox/async/boost/async/algorithm/wait.hpp 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,74 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/async for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ASYNC_WAIT__HPP
+#define BOOST_ASYNC_WAIT__HPP
+
+#include <boost/fusion/include/for_each.hpp>
+#include <boost/utility/enable_if.hpp>
+
+#ifdef BOOST_HAS_CHRONO_LIB
+#include <boost/chrono/chrono.hpp>
+#else
+#include <boost/thread/thread_time.hpp>
+#endif
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace async {
+
+ namespace result_of {
+ template <typename ACT>
+ struct wait {
+ typedef void type;
+ };
+ }
+
+ namespace partial_specialization_workaround {
+ template< typename ACT >
+ struct wait {
+ static typename result_of::template wait<ACT>::type apply( ACT& act ) {
+ return act.wait();
+ }
+ };
+ template< typename ACT >
+ struct wait<boost::detail::thread_move_t<ACT> > {
+ static typename result_of::template wait<ACT>::type apply( boost::detail::thread_move_t<ACT> act ) {
+ return act->wait();
+ }
+ };
+ }
+
+ template <typename ACT>
+ typename boost::enable_if<has_future_if<ACT>,
+ typename result_of::template wait<ACT>::type
+ >::type
+ wait(ACT& act) {
+ return partial_specialization_workaround::wait<ACT>::apply(act);
+ }
+ template <typename ACT>
+ void wait_act(ACT& act) {
+ return partial_specialization_workaround::wait<ACT>::apply(act);
+ }
+ template <typename ACT>
+ typename boost::enable_if<has_future_if<ACT>,
+ typename result_of::template wait<ACT>::type
+ >::type
+ wait(boost::detail::thread_move_t<ACT> act) {
+ return partial_specialization_workaround::wait<boost::detail::thread_move_t<ACT> >::apply(act);
+ }
+
+}
+} // namespace boost
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif

Added: sandbox/async/boost/async/algorithm/wait_all.hpp
==============================================================================
--- (empty file)
+++ sandbox/async/boost/async/algorithm/wait_all.hpp 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,70 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/async for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ASYNC_WAIT_ALL__HPP
+#define BOOST_ASYNC_WAIT_ALL__HPP
+
+#include <boost/fusion/include/for_each.hpp>
+
+#ifdef BOOST_HAS_CHRONO_LIB
+#include <boost/chrono/chrono.hpp>
+#else
+#include <boost/thread/thread_time.hpp>
+#endif
+
+#include <boost/async/algorithm/wait.hpp>
+#include <boost/fusion/support/is_sequence.hpp>
+#include <boost/utility/enable_if.hpp>
+//#include <boost/utility/disable_if.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace async {
+
+ namespace fct {
+ struct wait {
+ typedef void result_type;
+ template<typename ACT>
+ void operator()(ACT& act) const {
+ async::wait(act);
+ }
+ };
+ }
+
+ namespace result_of {
+ template <typename Sequence>
+ struct wait_all {
+ typedef typename fusion::result_of::for_each<Sequence, fct::wait>::type type;
+ };
+ }
+
+
+ template <typename Sequence>
+ typename boost::enable_if<fusion::traits::is_sequence<Sequence>,
+ typename result_of::template wait_all<Sequence>::type
+ >::type
+ wait_all(Sequence& t) {
+ fusion::for_each(t, fct::wait());
+ }
+
+ template <typename ACT>
+ typename boost::disable_if<fusion::traits::is_sequence<ACT>,
+ typename result_of::template wait<ACT>::type
+ >::type
+ wait_all(ACT& t) {
+ async::wait(t);
+ }
+}
+} // namespace boost
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif

Added: sandbox/async/boost/async/algorithm/wait_all_until.hpp
==============================================================================
--- (empty file)
+++ sandbox/async/boost/async/algorithm/wait_all_until.hpp 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,195 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/async for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ASYNC_WAIT_ALL_UNTIL__HPP
+#define BOOST_ASYNC_WAIT_ALL_UNTIL__HPP
+
+#include <boost/fusion/include/transform.hpp>
+
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/fusion/sequence/intrinsic/end.hpp>
+#include <boost/fusion/iterator/equal_to.hpp>
+#include <boost/fusion/iterator/next.hpp>
+#include <boost/fusion/iterator/deref.hpp>
+#include <boost/fusion/iterator/distance.hpp>
+//#include <boost/fusion/inlude/next.hpp>
+#include <boost/mpl/bool.hpp>
+
+
+#ifdef BOOST_HAS_CHRONO_LIB
+#include <boost/chrono/chrono.hpp>
+#else
+#include <boost/thread/thread_time.hpp>
+#endif
+
+#include <boost/async/algorithm/wait_until.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace async {
+
+
+
+ namespace fct {
+ struct wait_until {
+ wait_until(const system_time& abs_time) : abs_time_(abs_time) {}
+ template<typename ACT>
+ bool operator()(ACT& act) const {
+ return async::wait_until(act, abs_time_);
+ }
+ private:
+ const system_time& abs_time_;
+ };
+ }
+
+ namespace fct {
+ struct wait_for {
+ template <typename Duration>
+ wait_for(const Duration& rel_time) : abs_time_(get_system_time()+rel_time) {}
+ template<typename ACT>
+ bool operator()(ACT& act) const {
+ return wait_until(act, abs_time_);
+ }
+ private:
+ const system_time& abs_time_;
+ };
+ }
+
+ namespace result_of {
+ template <typename Sequence>
+ struct wait_all_until {
+ typedef bool type;
+ };
+ }
+
+ namespace result_of {
+ template <typename Sequence>
+ struct wait_all_for {
+ typedef bool type;
+ };
+ }
+
+
+namespace detail {
+ template<int N>
+ struct wait_all_until_unrolled
+ {
+ template<typename I0>
+ static bool call(I0 const& i0, const system_time& abs_time)
+ {
+ if (fct::wait_until(abs_time)(*i0)) return true;
+ else {
+ typedef typename fusion::result_of::next<I0>::type I1;
+ I1 i1(fusion::next(i0));
+ if(fct::wait_until(abs_time)(*i1)) return true;
+ else {
+ typedef typename fusion::result_of::next<I1>::type I2;
+ I2 i2(fusion::next(i1));
+ if(fct::wait_until(abs_time)(*i2)) return true;
+ else {
+ typedef typename fusion::result_of::next<I2>::type I3;
+ I3 i3(fusion::next(i2));
+ if(fct::wait_until(abs_time)(*i3)) return true;
+ else {
+ return wait_all_until_unrolled<N-4>::call(fusion::next(i3), abs_time);
+ }
+ }
+ }
+ }
+ }
+ };
+
+ template<>
+ struct wait_all_until_unrolled<3>
+ {
+ template<typename I0>
+ static bool call(I0 const& i0, const system_time& abs_time)
+ {
+ if (fct::wait_until(abs_time)(*i0)) return true;
+ else {
+ typedef typename fusion::result_of::next<I0>::type I1;
+ I1 i1(fusion::next(i0));
+ if(fct::wait_until(abs_time)(*i1)) return true;
+ else {
+ typedef typename fusion::result_of::next<I1>::type I2;
+ I2 i2(fusion::next(i1));
+ return fct::wait_until(abs_time)(*i2);
+ }
+ }
+ }
+ };
+
+ template<>
+ struct wait_all_until_unrolled<2>
+ {
+ template<typename I0>
+ static bool call(I0 const& i0, const system_time& abs_time)
+ {
+ if (fct::wait_until(abs_time)(*i0)) return true;
+ else {
+ typedef typename fusion::result_of::next<I0>::type I1;
+ I1 i1(fusion::next(i0));
+ return fct::wait_until(abs_time)(*i1);
+ }
+ }
+ };
+
+ template<>
+ struct wait_all_until_unrolled<1>
+ {
+ template<typename I0>
+ static bool call(I0 const& i0, const system_time& abs_time)
+ {
+ return fct::wait_until(abs_time)(*i0);
+ }
+ };
+
+ template<>
+ struct wait_all_until_unrolled<0>
+ {
+ template<typename It>
+ static bool call(It const&, const system_time&)
+ {
+ return true;
+ }
+ };
+
+ template <typename Sequence>
+ inline typename result_of::template wait_all_until<Sequence>::type
+ wait_all_until(Sequence& seq, const system_time& abs_time, fusion::random_access_traversal_tag)
+ {
+ typedef typename fusion::result_of::begin<Sequence>::type begin;
+ typedef typename fusion::result_of::end<Sequence>::type end;
+ return wait_all_until_unrolled<fusion::result_of::distance<begin, end>::type::value>::call(fusion::begin(seq), abs_time);
+ }
+
+
+}
+
+ template <typename Sequence>
+ typename result_of::template wait_all_until<Sequence>::type
+ wait_all_until(Sequence& seq, const system_time& abs_time) {
+ return detail::wait_all_until(seq, abs_time, typename fusion::traits::category_of<Sequence>::type());
+ }
+
+ template <typename Sequence, typename Duration>
+ typename result_of::template wait_all_for<Sequence>::type
+ wait_all_for(Sequence& t, Duration rel_time) {
+ return wait_all_until(t, get_system_time()+rel_time);
+ }
+
+
+}
+} // namespace boost
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif

Added: sandbox/async/boost/async/algorithm/wait_until.hpp
==============================================================================
--- (empty file)
+++ sandbox/async/boost/async/algorithm/wait_until.hpp 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,106 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/async for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ASYNC_WAIT_UNTIL__HPP
+#define BOOST_ASYNC_WAIT_UNTIL__HPP
+
+#include <boost/fusion/include/transform.hpp>
+#include <boost/utility/enable_if.hpp>
+
+#ifdef BOOST_HAS_CHRONO_LIB
+#include <boost/chrono/chrono.hpp>
+#else
+#include <boost/thread/thread_time.hpp>
+#endif
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace async {
+
+ namespace result_of {
+ template <typename ACT>
+ struct wait_until {
+ typedef bool type;
+ };
+ }
+
+ namespace result_of {
+ template <typename ACT, typename Duration>
+ struct wait_for {
+ typedef bool type;
+ };
+ }
+
+ namespace partial_specialization_workaround {
+ template< typename ACT >
+ struct wait_until {
+ static typename result_of::template wait_until<ACT>::type apply( ACT& act, const system_time& abs_time ) {
+ return act.wait_until(abs_time);
+ }
+ };
+ template< typename ACT >
+ struct wait_until<boost::detail::thread_move_t<ACT> > {
+ static typename result_of::template wait_until<ACT>::type apply( boost::detail::thread_move_t<ACT> act, const system_time& abs_time ) {
+ return act.wait_until(abs_time);
+ }
+ };
+ template< typename ACT, typename Duration>
+ struct wait_for {
+ static typename result_of::template wait_for<ACT,Duration>::type apply( ACT& act, Duration abs_time ) {
+ return act.wait_for(abs_time);
+ }
+ };
+ template< typename ACT, typename Duration>
+ struct wait_for<boost::detail::thread_move_t<ACT>,Duration> {
+ static typename result_of::template wait_for<ACT,Duration>::type apply( boost::detail::thread_move_t<ACT> act, Duration abs_time ) {
+ return act.wait_for(abs_time);
+ }
+ };
+ }
+
+ template <typename ACT>
+ typename boost::enable_if<has_future_if<ACT>,
+ typename result_of::template wait_until<ACT>::type
+ >::type
+ wait_until(ACT& act, const system_time& abs_time) {
+ return partial_specialization_workaround::wait_until<ACT>::apply(act, abs_time);
+ }
+
+ template <typename ACT>
+ typename boost::enable_if<has_future_if<ACT>,
+ typename result_of::template wait_until<ACT>::type
+ >::type
+ wait_until(boost::detail::thread_move_t<ACT> act, const system_time& abs_time) {
+ return partial_specialization_workaround::wait_until<boost::detail::thread_move_t<ACT> >::apply(act, abs_time);
+ }
+
+ template <typename ACT, typename Duration>
+ typename boost::enable_if<has_future_if<ACT>,
+ typename result_of::wait_for<ACT,Duration>::type
+ >::type
+ wait_for(ACT& act, Duration rel_time) {
+ return partial_specialization_workaround::wait_for<ACT,Duration>::apply(act, rel_time);
+ }
+
+ template <typename ACT, typename Duration>
+ typename boost::enable_if<has_future_if<ACT>,
+ typename result_of::wait_for<ACT,Duration>::type
+ >::type
+ wait_for(boost::detail::thread_move_t<ACT> act, Duration rel_time) {
+ return partial_specialization_workaround::wait_for<boost::detail::thread_move_t<ACT>,Duration>::apply(act, rel_time);
+ }
+
+}
+} // namespace boost
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif

Added: sandbox/async/boost/async/typeof/basic_threader.hpp
==============================================================================
--- (empty file)
+++ sandbox/async/boost/async/typeof/basic_threader.hpp 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,25 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/async for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ASYNC_TYPEOF_BASIC_THREADER__HPP
+#define BOOST_ASYNC_TYPEOF_BASIC_THREADER__HPP
+
+#include <boost/async/basic_threader.hpp>
+#include <boost/typeof/typeof.hpp>
+
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
+
+BOOST_TYPEOF_REGISTER_TYPE(boost::async::basic_threader)
+BOOST_TYPEOF_REGISTER_TYPE(boost::thread)
+
+#endif

Added: sandbox/async/boost/async/typeof/future.hpp
==============================================================================
--- (empty file)
+++ sandbox/async/boost/async/typeof/future.hpp 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,27 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/async for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ASYNC_TYPEOF_FUTURE__HPP
+#define BOOST_ASYNC_TYPEOF_FUTURE__HPP
+
+#include <boost/futures/future.hpp>
+#include <boost/typeof/typeof.hpp>
+
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
+
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::futures::unique_future, 1)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::futures::shared_future, 1)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::futures::promise, 1)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::futures::packaged_task, 1)
+
+#endif

Added: sandbox/async/boost/async/typeof/launcher.hpp
==============================================================================
--- (empty file)
+++ sandbox/async/boost/async/typeof/launcher.hpp 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,27 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/async for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ASYNC_TYPEOF_LAUNCHER__HPP
+#define BOOST_ASYNC_TYPEOF_LAUNCHER__HPP
+
+#include <boost/async/launcher.hpp>
+#include <boost/async/typeof/future.hpp>
+#include <boost/typeof/typeof.hpp>
+
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
+
+BOOST_TYPEOF_REGISTER_TYPE(boost::async::launcher)
+
+BOOST_TYPEOF_REGISTER_TYPE(boost::async::shared_launcher)
+
+#endif

Added: sandbox/async/boost/async/typeof/scheduler.hpp
==============================================================================
--- (empty file)
+++ sandbox/async/boost/async/typeof/scheduler.hpp 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,25 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/async for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ASYNC_TYPEOF_SCHEDULER__HPP
+#define BOOST_ASYNC_TYPEOF_SCHEDULER__HPP
+
+#include <boost/async/scheduler.hpp>
+#include <boost/typeof/typeof.hpp>
+
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
+
+//BOOST_TYPEOF_REGISTER_TEMPLATE(boost::tp::pool, 1)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::tp::task, 1)
+
+#endif

Added: sandbox/async/boost/async/typeof/threader.hpp
==============================================================================
--- (empty file)
+++ sandbox/async/boost/async/typeof/threader.hpp 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,28 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/async for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ASYNC_TYPEOF_THREADER__HPP
+#define BOOST_ASYNC_TYPEOF_THREADER__HPP
+
+#include <boost/async/threader.hpp>
+#include <boost/typeof/typeof.hpp>
+
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
+
+BOOST_TYPEOF_REGISTER_TYPE(boost::async::unique_threader)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::async::unique_joiner, 1)
+
+BOOST_TYPEOF_REGISTER_TYPE(boost::async::shared_threader)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::async::shared_joiner, 1)
+
+#endif

Added: sandbox/async/boost/async/typeof/threader_decorator.hpp
==============================================================================
--- (empty file)
+++ sandbox/async/boost/async/typeof/threader_decorator.hpp 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,21 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/async for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ASYNC_TYPEOF_THREADER_DECORATOR__HPP
+#define BOOST_ASYNC_TYPEOF_THREADER_DECORATOR__HPP
+
+#include <boost/async/typeof/threader.hpp>
+#include <boost/async/threader_decorator.hpp>
+
+
+#endif

Added: sandbox/async/libs/async/doc/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/async/libs/async/doc/Jamfile.v2 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,57 @@
+
+# (C) Copyright 2008-2009 Vicente J Botet Escriba.
+#
+# Distributed under the Boost Software License, Version 1.0. (See accompanying
+# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#path-constant boost-images : ../../../../doc/src/images ;
+import quickbook ;
+
+xml async : async.qbk ;
+
+boostbook standalone
+ :
+ async
+ :
+ # HTML options first:
+ # Use graphics not text for navigation:
+ <xsl:param>navig.graphics=1
+ # How far down we chunk nested sections, basically all of them:
+ <xsl:param>chunk.section.depth=2
+ # Don't put the first section on the same page as the TOC:
+ <xsl:param>chunk.first.sections=1
+ # How far down sections get TOC's
+ <xsl:param>toc.section.depth=4
+ # Max depth in each TOC:
+ <xsl:param>toc.max.depth=2
+ # How far down we go with TOC's
+ <xsl:param>generate.section.toc.level=10
+ # Path for links to Boost:
+ <xsl:param>boost.root=../../../..
+ # Path for libraries index:
+ <xsl:param>boost.libraries=../../../../libs/libraries.htm
+ # Use the main Boost stylesheet:
+ <xsl:param>html.stylesheet=../../../../doc/html/boostbook.css
+
+ # PDF Options:
+ # TOC Generation: this is needed for FOP-0.9 and later:
+ #<xsl:param>fop1.extensions=1
+ # Or enable this if you're using XEP:
+ <xsl:param>xep.extensions=1
+ # TOC generation: this is needed for FOP 0.2, but must not be set to zero for FOP-0.9!
+ <xsl:param>fop.extensions=0
+ # No indent on body text:
+ <xsl:param>body.start.indent=0pt
+ # Margin size:
+ <xsl:param>page.margin.inner=0.5in
+ # Margin size:
+ <xsl:param>page.margin.outer=0.5in
+ # Yes, we want graphics for admonishments:
+ <xsl:param>admon.graphics=1
+ # Set this one for PDF generation *only*:
+ # default pnd graphics are awful in PDF form,
+ # better use SVG's instead:
+ <format>pdf:<xsl:param>admon.graphics.extension=".svg"
+ <format>pdf:<xsl:param>admon.graphics.path=$(boost-images)/
+ ;
+

Added: sandbox/async/libs/async/doc/images/fork.png
==============================================================================
Binary file. No diff available.

Added: sandbox/async/libs/async/doc/images/star.png
==============================================================================
Binary file. No diff available.

Added: sandbox/async/libs/async/doc/implementation.qbk
==============================================================================
--- (empty file)
+++ sandbox/async/libs/async/doc/implementation.qbk 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,12 @@
+[/
+ (C) Copyright 2008-2009 Vicente J Botet Escriba.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt).
+]
+
+[section:implementation Appendix C: Implementation Notes]
+
+TBC
+
+[endsect]

Added: sandbox/async/libs/async/doc/index.html
==============================================================================
--- (empty file)
+++ sandbox/async/libs/async/doc/index.html 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,9 @@
+<html>
+<head>
+<meta http-equiv="refresh" content="0; URL=html/index.html">
+</head>
+<body>
+Automatic redirection failed, please go to
+../../doc/html/async.html
+</body>
+</html>

Added: sandbox/async/libs/async/doc/installation.qbk
==============================================================================
--- (empty file)
+++ sandbox/async/libs/async/doc/installation.qbk 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,119 @@
+[/
+ (C) Copyright 2008-2009 Vicente J. Botet Escriba
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt).
+]
+
+
+[/======================================]
+[section:install Installing Async]
+[/======================================]
+
+[/=================================]
+[heading Getting Boost.Async]
+[/=================================]
+
+You can get the last stable release of __Boost_Async__ by downloading [^async.zip] from the
+[@http://www.boost-consulting.com/vault/index.php?directory=Concurrent%20Programming Boost Vault]
+
+You can also access the latest (unstable?) state from the [@https://svn.boost.org/svn/boost/sandbox/async Boost Sandbox].
+
+[/==================================]
+[heading Building Boost.Async]
+[/==================================]
+
+__Boost_Async__ is a header only library.
+
+[/=========================]
+[heading Build Requirements]
+[/=========================]
+
+
+[*Boost.Async] depends on Boost. You must use either Boost version 1.38.x
+or the version in SVN trunk. In particular, __Boost_Async__ depends on:
+
+[variablelist
+[
+ [[@http://www.boost.org/libs/bind [*Boost.Bind]]] [for bind, ...]
+]
+[
+ [[@http://www.boost.org/libs/config [*Boost.Config]]] [for ??? and abi_prefic_sufix, ...]
+]
+[
+ [[@http://www.boost.org/libs/fusion [*Boost.Fusion]]] [for tuples, and sequence algorithms ...]
+]
+[
+ [[@http://www.boost.org/libs/mpl [*Boost.MPL]]] [for transform, ...]
+]
+[
+ [[@http://www.boost.org/libs [*Boost.Preprocesor]]] [to simulate variadic templates , ...]
+]
+[
+ [[@http://www.boost.org/libs/smart_ptr [*Boost.SmartPtr]]] [for shared_ptr, ...]
+]
+[
+ [[@http://www.boost.org/libs/thread [*Boost.Threads]]] [for thread, mutex, condition_variable, ...]
+]
+[
+ [[@http://www.boost.org/libs/type_traits [*Boost.TypeTrais]]] [for is_void, remove_references, ...]
+]
+[
+ [[@http://www.boost.org/libs/typeof [*Boost.TypeOf]]] [to register the ACT types.]
+]
+[
+ [[@http://www.boost.org/libs [*Boost.Utility]]] [for result_of, enable_if...]
+]
+]
+
+In addition it depends on the following libraries that are not yet accepted on Boost
+[variablelist
+[
+ [[@http://www.boost.org/libs/futures [*Boost.Futures]]] [for futures]
+]
+[
+ [[@https://svn.boost.org/svn/boost/sandbox/threadpool/ [*Boost.ThreadPool]]] [Only when using the __AE__ boost::tp::pool and the __ACT__ boost::tp::task]
+]
+]
+
+And also will depend on a near future, conditionaly, on the following libraries that are even not submited to Boost.
+[variablelist
+[
+ [[@https://svn.boost.org/svn/boost/sandbox/chrono/ [*Boost.Chrono]]] [for time and duration]
+]
+[
+ [[@https://svn.boost.org/svn/boost/sandbox/move/ [*Boost.Move]]] [to emulate the move semantic.]
+]
+[
+ [[@http://home.roadrunner.com/~hinnant/unique_ptr03.html [*Boost.SmartPtr.UniquePtr]]] [for unique_ptr, ...]
+]
+
+]
+
+[/========================]
+[heading Exceptions safety]
+[/========================]
+
+All functions in the library are exception-neutral and provide strong guarantee of exception safety as long as
+the underlying parameters provide it.
+
+[/====================]
+[heading Thread safety]
+[/====================]
+
+All functions in the library are thread-unsafe except when noted explicitly.
+
+[/=======================]
+[heading Tested compilers]
+[/=======================]
+
+Currently, __Boost_Async__ has been tested in the following compilers/platforms:
+
+* GCC 3.4.4 Cygwin
+* GCC 3.4.6 Linux
+[/* GCC 4.3.2 Cygwin]
+* GCC 4.1.2 Linux
+
+[note Please send any questions, comments and bug reports to boost <at> lists <dot> boost <dot> org.]
+
+[endsect]
\ No newline at end of file

Added: sandbox/async/libs/async/doc/introduction.qbk
==============================================================================
--- (empty file)
+++ sandbox/async/libs/async/doc/introduction.qbk 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,429 @@
+[/
+ (C) Copyright 2008-2009 Vicente J Botet Escriba.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt).
+]
+[/=============================================================================]
+
+[/============================]
+[section:motivation Motivation]
+[/============================]
+
+[section Asynchronous Executors and Asynchronous Completion Token Handles]
+[/=======================================================================]
+
+In [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1883.pdf N1833 - Preliminary Threading Library Proposal for TR2]
+Kevlin Henney introduces the concept of `threader` an asynchronous executor and a function `thread()` that evaluates a function
+asynchronously and returns an asynchronous completion token `joiner`, able to join but also to get the value of the function result.
+
+In [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2185.html N2185 - Proposed Text for Parallel Task Execution]
+Peter Dimov introduces a `fork()` function able to evaluate a function asynchronously and returns a `future` handle.
+
+In [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2276.html N2276 - Thread Pools and Futures]
+Anthony William introduces `launch_in_thread` and `launch_in_pool` function templates which
+evaluates a function asynchronously either in a specific `thread` or a thread pool and
+returns a `unique_future` handle.
+
+In [@http://www.boostpro.com/vault/index.php?action=downloadfile&filename=boost-threadpool.3.tar.gz&directory=Concurrent%20Programming& Boost.ThreadPool]
+Oliver Kowalke proposes a complete implementation of a thread `pool` with a `submit()` function
+which evaluates a function asynchronously and returns a `task` handle.
+
+Behind all these proposals there is a concept of asynchronous executor, fork-like function and
+the asynchronous completion token handle.
+
+[table AE/ACT/fork-like relationship
+ [
+ [[*Proposal]] [[*executor]] [[*fork-like]] [[*ACT handle]]
+ ]
+ [
+ [Boost.Thread] [`thread` class] [`thread()` constructor] [__thread__]
+ ]
+ [
+ [Boost.ThreadPool] [__tp_pool__] [`submit()`] [__tp_task__]
+ ]
+ [
+ [N2276] [__thread__] [`launch_in_thread()`] [`unique_future<T>`]
+ ]
+ [
+ [N2276] [thread_pool] [`launch_in_pool()`] [`unique_future<T>`]
+ ]
+ [
+ [N2185] [thread pool] [`fork()`] [`future<T>`]
+ ]
+ [
+ [N1833] [`threader`] [`thread()`] [`joiner<T>`]
+ ]
+]
+
+The asynchronous completion token models can follow two interfaces, the thread interface and
+the future interface. Some asynchronous completion tokens handle allow to recover the result of the evaluation of
+the function, others allow to manage the underlying thread of execution.
+
+It seems natural to make a generic __fork__ function that will evaluate a function asynchronously
+with respect to the calling thread and returns an ACT handle. The following metafunction
+associates an ACT handle to an asynchronous executor.
+
+ template <typename AE, typename T>
+ struct asynchronous_completion_token {
+ typedef typename AE::template handle<T>::type type;
+ };
+
+The result of forking a nullary function by an asynchronous executor is given by the metafunction result_of::fork<AE,F>
+
+ namespace result_of {
+ template <typename AE,typename F>
+ struct __c_fork__ {
+ typedef typename boost::result_of<F()>::type result_type;
+ typedef typename asynchronous_completion_token<AE, result_type>::type type;
+ };
+ }
+
+The default implementation of fork delegates on fork asynchronous executor function.
+
+ template< typename AE, typename F >
+ typename result_of::fork<AE, F>::type fork( AE& ae, F fn ) {
+ return ae.fork(fn);
+ }
+
+Forking n-ary functions rely on the nullary version and bind.
+
+ template< typename AE, typename F, typename A1, ..., typename An >
+ typename asynchronous_completion_token<AE,
+ typename boost::result_of<F(A1,..., An)>::type >::type
+ fork( AE& ae, F fn, A1 a1, ..., An an ) {
+ return ae.fork( bind( fn, a1, ..., an ) );
+ }
+
+We can define a basic_threader which just returns a new thread as follows:
+
+ class basic_threader {
+ public:
+ template <typename T>
+ struct handle {
+ typedef boost::thread type;
+ };
+
+ template <typename F>
+ boost::thread fork(F f) {
+ thread th(f);
+ return boost::move(th);
+ }
+ };
+
+The library includes also a launcher class that creates a thread and returns a unique_future when forking
+
+ class launcher {
+ public:
+ template <typename T>
+ struct handle {
+ typedef unique_future<T> type;
+ };
+ template <typename F>
+ unique_future<typename 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> res = tsk.get_future();
+ thread th(boost::move(tsk));
+ return res;
+ }
+ };
+
+and a shared_launcher class that creates a thread and returns a shared_future when forking.
+
+Given the sequential example:
+
+ double f( double a, int n )
+ {
+ double r = 0.0;
+
+ for( int i = 1; i <= n; ++i )
+ {
+ double x = 1.0 / i;
+ r += std::pow( x, a );
+ }
+
+ return r;
+ }
+
+ int main()
+ {
+ double m1 = f( 1.0, 1000000 );
+ double m2 = f( 1.0, 5000000 );
+ double m3 = f( 2.2, 1000000 );
+ double m4 = f( 2.2, 5000000 );
+
+ std::cout << m2 - m1 + m3 - m4 << std::endl;
+ }
+
+The library allows a programmer to switch to parallel execution as follows:
+
+ int main()
+ {
+ launcher l;
+ boost::unique_future<double> fm1 = basync::fork( l, f, 1.0, 1000000 );
+ boost::unique_future<double> fm2 = basync::fork( l, f, 1.0, 5000000 );
+ boost::unique_future<double> fm3 = basync::fork( l, f, 2.2, 1000000 );
+ boost::unique_future<double> fm4 = basync::fork( l, f, 2.2, 5000000 );
+
+ std::cout << fm2.get() - fm1.get() + fm3.get() - fm4.get() << std::endl;
+ }
+
+
+The question now is how we can adapt the example to an existing asynchronous executor such as
+the Boost.ThreadPool library. We need to specialize the template class
+asynchronous_completion_token to state which is the __ACT__ associate to the __tp_pool__.
+
+ namespace boost { namespace async {
+
+ template <typename Channel, typename T>
+ struct asynchronous_completion_token<boost::tp::pool<Channel>,T> {
+ typedef boost::tp::task<T> type;
+ };
+
+ }}
+
+and also to specialize the fork function as the default one requires a fork member function and __tp_pool__ provides a `submit()` member function`
+
+ namespace boost { namespace async {
+
+ template< typename Channel, typename F >
+ result_of::fork<boost::tp::pool<Channel>, F>::type
+ fork<boost::tp::pool<Channel>,F>( boost::tp::pool<Channel>& ae, F fn ) {
+ return ae.submit(fn);
+ }
+ }
+ }
+
+Evidently these specializations must be done on the `boost::async` namespace.
+
+As the preceding is ilegal in C++03 we need to use an auxiliary class to define the default behaviour of the fork function
+
+ 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 result_of::fork<AE,F>::type
+ fork( AE& ae, F fn ) {
+ return partial_specialization_workaround::fork<AE,F>::apply(ae,fn);
+ }
+
+And specialize partially the partial_specialization_workaround::fork class
+
+ namespace boost { namespace async {
+ 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);
+ }
+ };
+ }
+ }}
+
+Note that only the __fork__ function needs to be specialized. The library provides the other overloadings.
+
+We can write the preceding main function in a more generic way
+
+ template < typename AE>
+ void do(AE& ae)
+ {
+ typedef basync::result_of::fork<AE, int(*)(double, int) >::type auto_type;
+ auto_type fm1 = basync::fork(ae, f, 1.0, 1000000 );
+ auto_type fm2 = basync::fork(ae, f, 1.0, 5000000 );
+ auto_type fm3 = basync::fork(ae, f, 2.2, 1000000 );
+ auto_type fm4 = basync::fork(ae, f, 2.2, 5000000 );
+
+ std::cout << fm2.get() - fm1.get() + fm3.get() - fm4.get() << std::endl;
+ }
+
+ int main()
+ {
+ launcher ae;
+ do(ae);
+ }
+
+and we can switch from using the launcher or the tp::pool just by changing one line
+
+ int main()
+ {
+ boost::tp::pool<> ae(boost::tp::poolsize(6))
+ do(ae);
+ }
+
+Instead of defining a type, the user can make use of BOOST_AUTO once the
+associated files included on the threadpool sub-directory.
+
+ BOOST_AUTO(fm1, basync::fork(ae, f, 1.0, 1000000 ));
+
+
+The library allows also to fork several functions at one time
+
+ result_of::fork_all<AE, int(*)(), int(*)(), int(*)()>::type handles = basync::fork_all(ae, f, g, h);
+ std::cout << get<1>(res).get() - get<0>(res).get() + get<2>(res).get() << std::endl;
+
+
+The result of the fork_all operation is a fusion tuple of asynchronous completion token handles.
+The user can apply any fusion algorithm on this tuple as for example
+
+ bool b = fusion::none(handles, fct::interruption_requested());
+
+The asynchronous completion token models follows two interfaces, the thread interface and the
+unique_/shared_future interface.
+
+To make common tasks easier the library provides some functors in the name space fct:
+for the thread interface as
+
+* fct::join
+* fct::join_until
+* fct::join_for
+* fct::detach
+* fct::interrupt
+* fct::interrupt_requested
+
+and for the future operations as
+
+* fct::get
+* fct::wait
+* fct::wait_until
+* fct::wait_for
+* fct::is_ready
+* fct::has_value
+* fct::has_exception
+
+Here is an example for get:
+
+ namespace fct {
+ struct get {
+ template<typename ACT>
+ typename ACT::result_type operator()(ACT& t) const {
+ return t.get();
+ }
+ };
+ }
+
+In addition the library provides some non member functions that are the result of applying
+these functors to the tuple using a fusion algorithm:
+
+* join_all
+* join_all_until
+* join_all_for
+* detach_all
+* interrupt_all
+* interrupt_requested_on_all
+
+* get_all
+* wait_all
+* wait_all_until
+* wait_all_for
+* are_all_ready
+* have_all_value
+* have_all_exception
+
+Next follows how get_all is defined.
+
+ template <typename MovableTuple>
+ typename result_of::get_all<Sequence>::type
+ get_all(Sequence& t) {
+ return fusion::transform(t, fct::get());
+ }
+
+The library defines in a systematic way the result_of of a function as a metafunction
+having the same name as the function on the namespace result_of, as the Boost.Fusion library
+does.
+
+ namespace result_of {
+ template <typename Sequence>
+ struct get_all {
+ typedef typename fusion::result_of::transform<Sequence, fct::get>::type type
+ };
+ }
+
+So the user can do the following
+
+ result_of::fork_all<AE, int(*)(), int(*)(), int(*)()>::type res = basync::fork_all(ae, f, g, h);
+ result_of::get_all<result_of::fork_all<AE, int(*)(), int(*)(), int(*)()>::type>::type values
+ = basync::get_all(handles);
+
+or using a typedef
+
+ typedef result_of::fork_all<AE, int(*)(), int(*)(), int(*)()>::type auto_type;
+ auto_type handles = basync::fork_all(ae, f, g, h);
+ result_of::get_all<auto_type>::type values= basync::get_all(handles);
+
+Note that the notation can be shortened by using the C++0x auto keyword.
+
+ auto res = basync::fork_all(ae, f, g, h);
+ auto values = basync::get_all(handles);
+
+or using BOOST_AUTO
+
+ BOOST_AUTO(res, basync::fork_all(ae, f, g, h));
+ BOOST_AUTO(values, basync::get_all(handles));
+
+Last but not least the library provides also some sugaring functions like
+wait_for_all that forks and wait for the completion of all the functions.
+
+ result_of::wait_for_all<AE, int(*)(), int(*)(), int(*)()>::type res = basync::wait_for_all(ae, f, g, h);
+ std::cout << get<1>(res) - get<0>(res) + get<2>(res) << std::endl;
+
+and wait_for_any, which works only with functions that return the same type or are convertible to the same
+type, and return the index and the value of any of the completed functions.
+
+ result_of::wait_for_any<AE, int(*)(), int(*)(), int(*)()>::type res = basync::wait_for_any(ae, f, g, h);
+ std::cout << "function " << res.first << " finshed first with result=" << res.second << std::endl;
+
+The current implementation use the wait_for_any function so any AE must provide a way to get a
+unique|shared_future from its __ACT__.
+
+The library defines a functor allowing the user to specialize it
+
+ 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(); }
+ };
+
+Future versions will use the set_once synchronization.
+
+Resuming a simple way to define a new AsynchronousExecutor is to define a class as
+
+ struct AsynchronousExecutor {
+ template <typename T>
+ struct handle {
+ typedef implementation-specific-type-modeling-a-ACT type;
+ };
+
+ template <typename F>
+ typename handle<typename result_of<F()>::type>::type
+ fork(F f);
+ };
+
+
+
+
+[endsect]
+
+[section Threader/Joiner]
+[/=============================================================================]
+
+See the [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1883.pdf N1833 - Preliminary Threading Library Proposal for TR2]
+where Kevlin Henney introduces the concept of threader as an asynchronous executor and a function thread that evaluates a function
+asynchronously and returns an asynchronous completion token joiner, able to join but also to get the value of the function result.
+
+The main specificity is that here we make a difference between unique_joiner (move-only) and shared_joiner and as consequence unique_threader and shared_threader.
+
+
+[endsect]
+
+
+
+[endsect]

Added: sandbox/async/libs/async/doc/models.qbk
==============================================================================
--- (empty file)
+++ sandbox/async/libs/async/doc/models.qbk 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,269 @@
+[/
+ (C) Copyright 2008-2009 Vicente J Botet Escriba.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt).
+]
+[/=============================================================================]
+
+[/===============]
+[section Concepts]
+[/===============]
+
+[/=============================================]
+[section Asynchronous Completion Token Concepts]
+[/=============================================]
+
+[/==================]
+[section Concept `ACT` ]
+[/==================]
+
+An __ACT__ allows to to wait for the completion of an asynchronous executed operation.
+An __ACT__ should be __Movable__ or __CopyConstructible__.
+
+[variablelist Notation
+ [[`act`] [An __ACT__]]
+ [[`f`] [A __Nullary__ function with type F]]
+ [[`abs_time`] [A __system_time__]]
+ [[`rel_time`] [A __Duration__]]
+ [[`b`] [A bool]]
+]
+
+[heading Expression requirements]
+A type models a __AE__ if, the following expressions are valid:
+
+[table
+ [[Expression] [Return type] [Runtime Complexity]]
+ [[`act.wait()`] [void] [Constant]]
+ [[`b = act.wait_until(abs_time)`] [bool] [Constant]]
+ [[`b = act.wait_for(rel_time)`] [bool] [Constant]]
+]
+
+[heading Meta Expressions]
+[table
+ [[Expression] [Type] [Compile Time Complexity]]
+ [[`__is_movable__<ACT>::type`] [MPL boolean] [Constant]]
+ [[`__has_future_if__<ACT>::type`] [MPL boolean] [Constant]]
+ [[`__has_thread_if__<ACT>::type`] [MPL boolean] [Constant]]
+]
+
+[heading Expression Semantics]
+[
+table
+ [[Expression] [Semantics]]
+ [[`act.wait()`] [Waits until the `act` completes]]
+ [[`b = act.wait_until(abs_time)`] [Waits until the `act` completes until `abs_time` is not reached]]
+ [[`b = act.wait_for(rel_time)`] [Waits until the `act` completes for a `rel_time` duration]]
+]
+
+[heading Models]
+
+* __unique_future__
+* __shared_future__
+* __unique_joiner__
+* __shared_joiner__
+* __tp_task__
+* __thread__
+
+[endsect]
+
+[/=============================]
+[section Concept `FutureBasedACT` ]
+[/=============================]
+
+An __FutureBasedACT__ is a __ACT__ that associates a value expected on the its completion.
+
+[variablelist Notation
+ [[`act`] [An __ACT__]]
+ [[`f`] [A __Nullary_ function with type F]]
+ [[`abs_time`] [A __system_time__]]
+ [[`rel_time`] [A __Duration__]]
+ [[`b`] [A bool]]
+ [[`v`] [T]]
+]
+
+[heading Expression requirements]
+A type models an __FutureBasedACT__ if, in adition to being an __ACT__,
+the following expressions are valid:
+
+[table
+ [[Expression] [Return type] [Runtime Complexity]]
+ [[`b = act.is_ready()`] [bool] [Constant]]
+ [[`b = act.has_exception()`] [bool] [Constant]]
+ [[`b = act.has_value()`] [bool] [Constant]]
+]
+
+[heading Expression Semantics]
+[table
+ [[Expression] [Semantics]]
+ [[`b = act.is_ready()`] [Is true only if the associated state holds a value or an exception ready for retrieval.]]
+ [[`b = act.has_exception()`] [true only if the associated state contains an exception.]]
+ [[`b = act.has_value()`] [true only if the associated state contains a value]]
+ [[`v = act.get()`] [returns the stored value]]
+]
+
+[heading Models]
+
+* __unique_future__
+* __shared_future__
+* __unique_joiner__
+* __shared_joiner__
+* __tp_task__
+
+[endsect]
+
+[/=============================]
+[section Concept `ThreadBasedACT` ]
+[/=============================]
+
+An __FutureBasedACT__ is a __ACT__ that associates a value expected on the its completion.
+
+[variablelist Notation
+ [[`act`] [An __ACT__]]
+ [[`f`] [A __Nullary_ function with type F]]
+ [[`abs_time`] [A __system_time__]]
+ [[`rel_time`] [A __Duration__]]
+ [[`b`] [A bool]]
+ [[`id`] [A thread::id]]
+]
+
+[heading Expression requirements]
+A type models an __FutureBasedACT__ if, in adition to being an __ACT__,
+the following expressions are valid:
+
+[table
+ [[Expression] [Return type] [Runtime Complexity]]
+ [[`act.join()`] [void] [Constant]]
+ [[`b = act.joinable()`] [bool] [Constant]]
+ [[`b = act.join_until(abs_time)`] [bool] [Constant]]
+ [[`b = act.join_for(rel_time)`] [bool] [Constant]]
+ [[`act.detach()`] [void] [Constant]]
+ [[`act.interrupt()`] [void] [Constant]]
+ [[`b = act.interruption_requested()`] [bool] [Constant]]
+ [[`id = act.get_id()`] [bool] [Constant]]
+]
+
+[heading Expression Semantics]
+[table
+ [[Expression] [Semantics]]
+ [[`act.join()`] [Constant]]
+ [[`b = act.joinable()`] [Constant]]
+ [[`b = act.join_until(abs_time)`] [Constant]]
+ [[`b = act.join_for(rel_time)`] [Constant]]
+ [[`act.detach()`] [Constant]]
+ [[`act.interrupt()`] [Constant]]
+ [[`b = act.interruption_requested()`] [Constant]]
+ [[`is = act.get_id()`] [Constant]]
+]
+
+[heading Models]
+
+* __unique_joiner__
+* __shared_joiner__
+* __thread__
+* __tp_task__
+
+[endsect]
+
+[endsect]
+
+[/======================================]
+[section Asynchronous Executors Concepts]
+[/======================================]
+
+[/==========================================================================================]
+[section Concept `AsynchronousExecutor`]
+[/==========================================================================================]
+
+An __AsynchronousExecutor__ executes asynchronously a function and returns an __ACT__ when calling the fork function on it.
+
+[variablelist Notation
+ [[`ae`] [An __AE__]]
+ [[`f`] [A Nullary function with type F]]
+ [[`act`] [An __ACT__]]
+]
+
+[heading Expression requirements]
+A type models a __AE__ if, the following expressions are valid:
+
+[table
+ [[Expression] [Return type] [Runtime Complexity]]
+ [[`__fork__(ae, f)`] [__ACT__] [Constant]]
+ [[`get_future<AE>()(act)`] [__Future__] [Constant]]
+ [[`__asynchronous_completion_token__<AE, T>::type`] [Model of __ACT__ satisfying `__act_value<ACT>::type` is `T`] [Constant]]
+]
+
+[heading Meta Expressions]
+[table
+ [[Expression] [Model Of] [Compile Time Complexity]]
+ [[`get_future<AE>::type`] [] [Amortized constant time]]
+ [[`__result_of_advance_c__<I, N>::type`] [] [Linear]]
+]
+
+[heading Expression Semantics]
+[
+table
+ [[Expression] [Semantics]]
+ [[`act = __fork__(ae, f)`] [request `ae` to execute asynchronously the function `f`and returns an __ACT__ ]]
+ [[`get_future<AE>()(act)`] [gets a reference to a __Future__]]
+]
+
+[heading Constraints]
+The following constraints applies:
+
+* `act_value<__ACT__>::type == boost::result_of<F()::type>`
+
+[heading Models]
+
+* __unique_threader__
+* __shared_threader__
+
+[endsect]
+
+
+[/==========================================================================================]
+[section Concept `IntrinsicAsynchronousExecutor`]
+[/==========================================================================================]
+
+
+The default fork implementation put some requirements in its __AE__ parameter. This concept is related to this.
+An __IAE__ is __AE__ that works well with the default implementation of __fork__.
+
+[variablelist Notation
+ [[`ae`] [An __IAE__]]
+ [[`f`] [A __Nullary__ function]]
+]
+
+[heading Expression requirements]
+A type models an __IAE__ if, in adition to being an __AE__,
+the following expressions are valid:
+
+[table
+ [[Expression] [Return type] [Runtime Complexity]]
+ [[`ae.fork(f)`] [`handle<boost::result_of<F()>::type`] [Constant]]
+]
+
+[heading Meta Expressions]
+[table
+ [[Expression] [Model Of] [Compile Time Complexity]]
+ [[`handle<boost::result_of<F()>::type`] [__ACT__] [Constant ]]
+]
+
+[heading Expression Semantics]
+[
+table
+ [[Expression] [Semantics]]
+ [[`ae.fork(f)`] [executes asynchronously the function `f`and returns a __handle__ ]]
+]
+
+
+[heading Models]
+* __unique_threader__
+* __shared_threader__
+
+
+[endsect]
+
+[endsect]
+
+[endsect]

Added: sandbox/async/libs/async/doc/overview.qbk
==============================================================================
--- (empty file)
+++ sandbox/async/libs/async/doc/overview.qbk 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,73 @@
+[/
+ (C) Copyright 2008-2009 Vicente J Botet Escriba.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt).
+]
+
+[/========================]
+[section:overview Overview]
+[/========================]
+
+[/==================]
+[heading Description]
+[/==================]
+
+Boost.Async is a C++ library to allow the calling of functions and functors in an asynchronous manner, thereby making it easier to improve the level of concurrency and parallelism in your applications. It provides:
+
+* An asynchronous execution framework working with __AE__ and __ACT__. It includes some generic functions and several __AE__ and __ACT__:
+ * fork and fork_all to execute asynchronously functions
+ * fork_after: request an __AE__ to execute a function asynchronously once each one of __ACT__ in the dependency tuple parameter are ready. It is similar to the async_with_dependencies proposed Peter Dimov.
+ * generic get, join, ... free functions to synchroyze on an __ACT__
+ * generic get_all, join_all, ... free functions to synchroyze on multiple __ACT__
+ * generic wait_for_all, wait_for_any to execute asynchronously functions and wait for the completion of all or any of them.
+
+* Some __AE__ and __ACT__ models
+ * basic_threader: can be seen as a thread factory executing asynchronously a function on the returned thread.
+ * launchers: Lanchers can be seen as a future factory executing asynchronously a function on a hiden thread.
+ * threader/joiner: A Threader runs a unary function in its own thread. A Threader can be seen as a Joiner
+ factory executing asynchronously a function on a thread encapsulated on the returned Joiner. The joiner is used
+ to synchronise with and pick up the result from a function or to manage the encapsulated thread.
+ * __tp_pool__ and __tp_task__ customization as an __AE__ and an __ACT__ respectively. __tp_pool__ can be seen as
+ a __tp_task__ factory executing asynchronously a function on a pool of threads.
+ * a generic asynchronous_executor_decorator which allows to decorate the function to be evaluated asynchronously.
+
+References
+
+* threader/joiner are based on the original idea of Kevlin Henney [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1883.pdf N1833 - Preliminary Threading Library Proposal for TR2]
+
+
+[/====================================]
+[heading How to Use This Documentation]
+[/====================================]
+
+This documentation makes use of the following naming and formatting conventions.
+
+* Code is in `fixed width font` and is syntax-highlighted.
+* Replaceable text that you will need to supply is in [~italics].
+* If a name refers to a free function, it is specified like this:
+ `free_function()`; that is, it is in code font and its name is followed by `()`
+ to indicate that it is a free function.
+* If a name refers to a class template, it is specified like this:
+ `class_template<>`; that is, it is in code font and its name is followed by `<>`
+ to indicate that it is a class template.
+* If a name refers to a function-like macro, it is specified like this: `MACRO()`;
+ that is, it is uppercase in code font and its name is followed by `()` to
+ indicate that it is a function-like macro. Object-like macros appear without the
+ trailing `()`.
+* Names that refer to /concepts/ in the generic programming sense are
+ specified in CamelCase.
+
+[note In addition, notes such as this one specify non-essential information that
+provides additional background or rationale.]
+
+Finally, you can mentally add the following to any code fragments in this document:
+
+ // Include all of Async
+ #include <boost/async/async.hpp>
+
+ // Create a namespace aliases
+ namespace basync = boost::async;
+
+[include introduction.qbk]
+[endsect]

Added: sandbox/async/libs/async/doc/rationale.qbk
==============================================================================
--- (empty file)
+++ sandbox/async/libs/async/doc/rationale.qbk 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,14 @@
+[/
+ (C) Copyright 2008-2009 Vicente J Botet Escriba.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt).
+]
+
+[/=======================================]
+[section:rationale Appendix B: Rationale]
+[/=======================================]
+
+TBC
+
+[endsect]

Added: sandbox/async/libs/async/doc/reference.qbk
==============================================================================
--- (empty file)
+++ sandbox/async/libs/async/doc/reference.qbk 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,90 @@
+[/
+ (C) Copyright 2008-2009 Vicente J. Botet Escriba
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt).
+]
+
+[/==========================]
+[section:reference Reference]
+[/==========================]
+[include concepts.qbk]
+
+
+[section AE/ACT Framework Reference]
+
+[include reference/act_traits.qbk]
+
+[section AE operations]
+
+[include reference/fork.qbk]
+[include reference/fork_after.qbk]
+[include reference/fork_all.qbk]
+[include reference/wait_for_all.qbk]
+[include reference/wait_for_any.qbk]
+
+[endsect]
+
+[include reference/algorithm.qbk]
+
+[section Future based ACT operations]
+[include reference/wait.qbk]
+[include reference/wait_until.qbk]
+[include reference/get.qbk]
+[include reference/is_ready.qbk]
+[include reference/has_value.qbk]
+[include reference/has_exception.qbk]
+
+[include reference/wait_all.qbk]
+[include reference/wait_all_until.qbk]
+[include reference/get_all.qbk]
+[include reference/are_all_ready.qbk]
+[include reference/have_all_value.qbk]
+[include reference/have_all_exception.qbk]
+
+[endsect]
+
+[section Thread based ACT operations]
+
+[include reference/detach.qbk]
+[include reference/joinable.qbk]
+[include reference/join.qbk]
+[include reference/join_until.qbk]
+[include reference/interrupt.qbk]
+[include reference/interruption_requested.qbk]
+
+
+[include reference/detach_all.qbk]
+[include reference/join_all.qbk]
+[include reference/are_all_joinable.qbk]
+[include reference/join_all_until.qbk]
+[include reference/interrupt_all.qbk]
+[include reference/interruption_requested_all.qbk]
+[endsect]
+
+
+[endsect]
+
+[section AE/ACT Models Reference]
+
+[include reference/basic_threader.qbk]
+[include reference/launcher.qbk]
+[include reference/threader.qbk]
+[include reference/scheduler.qbk]
+
+[include reference/typeof/futures.qbk]
+[include reference/typeof/launcher.qbk]
+[include reference/typeof/threader.qbk]
+[include reference/typeof/basic_threader.qbk]
+[include reference/typeof/scheduler.qbk]
+
+[include reference/asynchronous_executor_decorator.qbk]
+[/include reference/basic_threader_decorator.qbk]
+[/include reference/threader_decorator.qbk]
+[/include reference/launcher_decorator.qbk]
+
+[/include reference/asynchronous_adapter.qbk]
+
+[endsect]
+
+[endsect]

Added: sandbox/async/libs/async/doc/tests.qbk
==============================================================================
--- (empty file)
+++ sandbox/async/libs/async/doc/tests.qbk 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,56 @@
+[/
+ (C) Copyright 2008-2009 Vicente J Botet Escriba.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt).
+]
+
+[section:tests Appendix E: Tests]
+
+
+[section AE/ACT]
+[table
+ [[Name] [Description] [Pool] [BaTh][ShLa][ShTh][UnLa][UnLa] [Ticket]]
+ [[do_test_member_fork] [Forks and get] [Pass] [????][Pass][Pass][????][????] [#]]
+ [[do_test_member_fork_m] [Forks and get] [????] [Pass][Pass][????][????][????] [#]]
+ [[do_test_member_fork_bind] [Forks and get] [Pass] [Pass][Pass][Pass][????][????] [#]]
+ [[do_test_member_fork_bind_m] [Forks and get] [????] [????][Pass][????][????][????] [#]]
+ [[do_test_fork] [Forks a nullary function and get] [Pass] [Pass][Pass][Pass][????][????] [#]]
+ [[do_test_fork_1] [Forks a unary function and get] [Pass] [Pass][Pass][Pass][????][????] [#]]
+ [[do_test_fork_1_m] [Forks a unary function and get] [????] [????][Pass][????][????][????] [#]]
+ [[do_test_creation_through_functor] [Forks a functor] [Pass] [????][Pass][Pass][????][????] [#]]
+ [[do_test_creation_through_reference_wrapper] [Forks a reference wrapper] [Pass] [????][Pass][Pass][????][????] [#]]
+
+
+ [[do_test_wait] [Forks and waits] [Pass] [????][Pass][Pass][????][????] [#]]
+ [[do_test_wait_until] [Forks and waits until a given time] [Pass] [????][Pass][Pass][????][????] [#]]
+ [[do_test_wait_for] [Forks and waits for a given time] [Pass] [????][Pass][Pass][????][????] [#]]
+ [[do_test_get] [Forks and get ] [????] [----][Pass][????][????][????] [#]]
+ [[do_test_wait_all] [Forks several and waits all] [Pass] [----][Pass][Pass][????][????] [#]]
+ [[do_test_wait_all_until] [Forks several and waits all until a given time] [????] [----][Pass][Pass][????][????] [#]]
+ [[do_test_wait_all_for] [Forks several and waits all for a given time] [????] [----][????][????][????][????] [#]]
+ [[do_test_set_all] [Forks several and get all using set_all] [Pass] [----][Pass][Pass][????][????] [#]]
+ [[do_test_get_all] [Forks several and get all] [Pass] [----][Fail][Pass][????][????] [#]]
+ [[do_test_wait_for_all] [wait for all] [Pass] [----][Pass][Pass][????][????] [#]]
+ [[do_test_wait_for_any] [waits for any] [Fail] [----][Pass][Pass][????][????] [#]]
+ [[do_test_wait_for_any_fusion_sequence] [Wait for any in a fusion sequence] [Fail] [????][????][Pass][????][????] [#]]
+
+ [[do_test_member_fork_detach] [Forks and detach] [Fail] [????][----][Pass][????][????] [#]]
+ [[do_test_thread_interrupts_at_interruption_point] [Interrupt] [Pass] [????][----][Pass][????][????] [#]]
+ [[do_test_join] [Forks and join] [Pass] [Pass][Pass][Pass][????][????] [#]]
+ [[do_test_join_until] [Forks and joins until a given time] [Pass] [Pass][Pass][Pass][????][????] [#]]
+ [[do_test_join_for] [Forks and joins for a given time] [Pass] [Pass][Pass][Pass][????][????] [#]]
+ [[do_test_join_all] [Forks several and join all] [Pass] [----][Pass][Pass][????][????] [#]]
+ [[do_test_join_all_until] [Forks several and join all until a given time] [????] [----][????][????][????][????] [#]]
+ [[do_test_join_all_for] [Forks several and join all for a given time] [????] [----][????][????][????][????] [#]]
+
+ [[do_test_fork_after_join] [Fork after some dependent ACT and then join] [Pass] [????][Pass][Pass][????][????] [#]]
+ [[do_test_fork_after_wait] [Fork after some dependent ACT and then wait] [Pass] [????][Pass][Pass][????][????] [#]]
+ [[do_test_fork_after_get] [Fork after some dependent ACT and then get the value] [Pass] [????][Pass][Pass][????][????] [#]]
+ [[XXXXXXXXXXXXXXXXXXXXXX] [XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX] [XXXX] [????][????][????][????][????] [#]]
+
+]
+
+[endsect]
+
+[endsect]

Added: sandbox/async/libs/async/doc/threade_joiner.qbk
==============================================================================
--- (empty file)
+++ sandbox/async/libs/async/doc/threade_joiner.qbk 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,138 @@
+[/
+ (C) Copyright 2008-2009 Vicente J Botet Escriba.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt).
+]
+[/=============================================================================]
+
+[/=============================================================================]
+[section Threader/Joiner]
+[/=============================================================================]
+
+Threading in Boost.Threads is currently based on the idea that a thread is
+identified with an object that launches it. This notion is somewhat confused by
+the idea that on destruction the thread object is destroyed but the thread is not
+- in other words the thread is not identified the thread object... except when it
+is.
+
+Another appropriate separation is the distinction between initialization and
+execution. These are significantly different concepts but they are conflated in
+the existing thread-launching interface: the constructor is responsible both for
+preparing the thread and launching it, which means that it is not possible for
+one piece of code to set up a thread and another to initiate it separately at its
+own discretion, e.g. thread pools. Separating the two roles into constructor and
+executor function clears up both the technical and the conceptual issue. The
+executor function can be reasonably expressed as an overloaded function-call
+operator, or a start function.
+
+ void task();
+ ...
+ thread async_function;
+ ...
+ asynch_functiont(task);
+
+The separation also offers a simple and non-intrusive avenue for platform specific
+extension of how a thread is to execute: configuration details such as
+scheduling policy, stack size, security attributes, etc, can be added as
+parameters to t without intruding on the signatures of any other function in the
+threading interface:
+
+ size_t stack_size = ...;
+ security_attributes security(...);
+ thread async_function(stack_size, security);
+
+The default constructor could be the feature standardized, and the Boost
+implementation could add additional constructors as appropriate.
+
+Given that the same configuration might be used to launch other threads, and
+given the identity confusion of a thread being an object except when it's not, we
+can consider the interface not to be the interface of a thread but to be the
+interface of a thread launcher, i.e. an executor. A thread initiator can submit
+zero-argument functions and function objects to an executor for execution:
+
+ threader run;
+ ...
+ run(first_task);
+ run(second_task);
+
+Boost.InterThreads offers several asynchronous executors types and variables, but as
+a concept an asynchronous executor could be implemented in a variety of ways that still
+conform to the same basic launching interface, i.e. the function-call operator..
+
+Given that a threader can be used to launch multiple threads, there is the
+obvious question of how to join with each separately run thread. Instead of
+returning void, the threader returns an object whose primary purpose is to
+represent the ability to join with the completion of a separately executing thread
+of control.
+
+ joiner wait = run(first_task);
+
+The role played by the joiner in this fragment is that of an asynchronous
+completion token, a common pattern for synchronizing with and controlling
+asynchronous tasks. Via the joiner the initiator can poll or wait
+for the completion of the running thread, and control it in other ways, some of
+which may be platform specific extensions.
+
+joiner is Movable. Its principal action, the act of joining, can be expressed as a function
+call:
+joiner join = run(first_task);
+...
+join();
+
+If there are no joiners for a given thread, that thread is considered detached, a
+role currently played in Boost.Threads by the thread destructor:
+
+ run(second_task); // runs detached because return value ignored
+
+Boost.Threads does
+not return a value from a completed thread when joined. For many threaded
+tasks this makes sense, but where a thread is working towards a result then the
+idea that an asynchronously executed function can return a value for later
+collection should not be discarded. With a void-returning interface the
+programmer is forced to set up an arrangement for the threaded task to
+communicate a value to the party that wants the one-time result. This is tedious
+for such a simple case, and can be readily catered for by making the joiner a
+proper future variable that proxies the result. This leads to the threader
+interface looking like the following:
+
+ class threader
+ {
+ public:
+ threader();
+
+ template<typename nullary_function>
+ joiner<result_of<nullary_function()>::type> operator()(nullary_function);
+ ...
+ };
+
+For the common default configured threader, a wrapper function, fork, can be
+provided:
+
+ template<typename nullary_function>
+ joiner<result_of<nullary_function>::type> fork(nullary_function);
+
+And use it as follows:
+
+ void void_task();
+ int int_task();
+ ...
+ joiner<void> t1 = fork(void_task);
+ joiner<int> t2 = fork(int_task);
+ ...
+ int result = t1.get();
+ t2.join();
+
+The benefit of programming with futures is that for a certain class of code that
+would use end-of-thread synchronization to pick up results, programmers are
+not presented with unnecessarily low-level synchronization APIs. The function based
+model is applied consistently.
+
+When the application needs only the result it seems interesting to return only
+the future value associated to the unary function result..
+
+ unique_future<int> t3 = launch(int_task);
+
+
+[endsect]
+

Added: sandbox/async/libs/async/doc/tickets.qbk
==============================================================================
--- (empty file)
+++ sandbox/async/libs/async/doc/tickets.qbk 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,18 @@
+[/
+ (C) Copyright 2008-2009 Vicente J Botet Escriba.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt).
+]
+
+[section:tickets Appendix F: Tickets]
+
+
+[table
+[[Kind] [Identifier] [Description] [Resolution] [State] [Tests] [Version]]
+
+]
+
+
+
+[endsect]

Added: sandbox/async/libs/async/doc/tutorial.qbk
==============================================================================
--- (empty file)
+++ sandbox/async/libs/async/doc/tutorial.qbk 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,17 @@
+[/
+ (C) Copyright 2008-2009 Vicente J Botet Escriba.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt).
+]
+
+[section:tutorial Tutorial]
+[/========================]
+
+
+[section AE/ACT framework]
+[endsect]
+
+
+
+[endsect]
\ No newline at end of file

Added: sandbox/async/libs/async/doc/users_guide.qbk
==============================================================================
--- (empty file)
+++ sandbox/async/libs/async/doc/users_guide.qbk 2009-04-19 05:41:33 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,51 @@
+[/
+[/
+ (C) Copyright 2008-2009 Vicente J. Botet Escriba
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt).
+]
+
+[/==============================]
+[section:users_guide Users'Guide]
+[/==============================]
+
+[include getting_started.qbk]
+[include tutorial.qbk]
+
+
+[/==============================]
+[section:bibliography References]
+[/==============================]
+
+
+[variablelist
+[[[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1883.pdf N1833 - Preliminary Threading Library Proposal for TR2]] []]
+[[[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2185.html N2185 - Proposed Text for Parallel Task Execution]] []]
+[[[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2276.html N2276 - Thread Pools and Futures]] []]
+[[[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2802.html N2802: A plea to reconsider detach-on-destruction for thread objects] ] []]
+[[[@http://www.boostpro.com/vault/index.php?action=downloadfile&filename=boost-threadpool.3.tar.gz&directory=Concurrent%20Programming& Boost.ThreadPool (O. Kowalke)]] []]
+[[[@http://www.justsoftwaresolutions.co.uk/threading/free-implementation-of-c++-futures.html Boost.Futures (A. Williams)]] []]
+[[[@http://www.boost.org/libs/thread Boost.Thread (A. Williams)]] []]
+[[[@http://www.mr-edd.co.uk/?page_id=58 async (Edd )]] []]
+]
+
+
+
+[endsect]
+
+
+[/=======================]
+[section:glosary Glossary]
+[/=======================]
+
+
+[variablelist
+
+[[AE] [Asynchronous executor]]
+[[ACT] [Asynchronous completion token]]
+]
+
+[endsect]
+
+[endsect]
\ No newline at end of file


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