Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r50466 - in sandbox/interthreads/boost/interthreads: . algorithm detail
From: vicente.botet_at_[hidden]
Date: 2009-01-04 13:05:38


Author: viboes
Date: 2009-01-04 13:05:36 EST (Sun, 04 Jan 2009)
New Revision: 50466
URL: http://svn.boost.org/trac/boost/changeset/50466

Log:
interthreads version 0.2
Adding threader/joiner
Adding Asynchronous Executors fmk
Added:
   sandbox/interthreads/boost/interthreads/algorithm/
   sandbox/interthreads/boost/interthreads/algorithm/detach_all.hpp (contents, props changed)
   sandbox/interthreads/boost/interthreads/algorithm/get_all.hpp (contents, props changed)
   sandbox/interthreads/boost/interthreads/algorithm/get_all_until.hpp (contents, props changed)
   sandbox/interthreads/boost/interthreads/algorithm/interrupt_all.hpp (contents, props changed)
   sandbox/interthreads/boost/interthreads/algorithm/interruption_requested_on_all.hpp (contents, props changed)
   sandbox/interthreads/boost/interthreads/algorithm/join_all.hpp (contents, props changed)
   sandbox/interthreads/boost/interthreads/algorithm/join_all_until.hpp (contents, props changed)
   sandbox/interthreads/boost/interthreads/algorithm/wait_all.hpp (contents, props changed)
   sandbox/interthreads/boost/interthreads/algorithm/wait_all_until.hpp (contents, props changed)
   sandbox/interthreads/boost/interthreads/detail/
   sandbox/interthreads/boost/interthreads/detail/config.hpp (contents, props changed)
   sandbox/interthreads/boost/interthreads/detail/platform.hpp (contents, props changed)
Text files modified:
   sandbox/interthreads/boost/interthreads/set_once.hpp | 52 +++++-
   sandbox/interthreads/boost/interthreads/thread_and_join.hpp | 71 ++++++--
   sandbox/interthreads/boost/interthreads/thread_decorator.hpp | 22 ++
   sandbox/interthreads/boost/interthreads/thread_group_once.hpp | 38 +---
   sandbox/interthreads/boost/interthreads/thread_keep_alive.hpp | 23 +-
   sandbox/interthreads/boost/interthreads/thread_specific_shared_ptr.hpp | 4
   sandbox/interthreads/boost/interthreads/thread_tuple.hpp | 311 +++++++++++++++++++++++++++++++--------
   sandbox/interthreads/boost/interthreads/thread_tuple_once.hpp | 55 ++----
   8 files changed, 407 insertions(+), 169 deletions(-)

Added: sandbox/interthreads/boost/interthreads/algorithm/detach_all.hpp
==============================================================================
--- (empty file)
+++ sandbox/interthreads/boost/interthreads/algorithm/detach_all.hpp 2009-01-04 13:05:36 EST (Sun, 04 Jan 2009)
@@ -0,0 +1,49 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2008. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/interthreads for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTERTHREADS_DETACH_ALL__HPP
+#define BOOST_INTERTHREADS_DETACH_ALL__HPP
+
+#include <boost/fusion/include/for_each.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace interthreads {
+
+ 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/interthreads/boost/interthreads/algorithm/get_all.hpp
==============================================================================
--- (empty file)
+++ sandbox/interthreads/boost/interthreads/algorithm/get_all.hpp 2009-01-04 13:05:36 EST (Sun, 04 Jan 2009)
@@ -0,0 +1,54 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2008. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/interthreads for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTERTHREADS_GET_ALL__HPP
+#define BOOST_INTERTHREADS_GET_ALL__HPP
+
+#include <boost/fusion/include/transform.hpp>
+
+#ifdef BOOST_HAS_CHRONO_LIB
+#include <boost/chono/chono.hpp>
+#else
+#include <boost/thread/thread_time.hpp>
+#endif
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace interthreads {
+
+ namespace fct {
+ struct get {
+ template<typename ACT>
+ typename ACT::result_type operator()(ACT& act) const {
+ return act.get();
+ }
+ };
+ }
+
+ namespace result_of {
+ template <typename Sequence>
+ struct get_all {
+ typedef typename fusion::result_of::transform<Sequence, fct::get>::type type;
+ };
+ }
+
+ template <typename Sequence>
+ typename result_of::get_all<Sequence>::type
+ get_all(Sequence& t) {
+ return fusion::transform(t, fct::get());
+ }
+
+}
+} // namespace boost
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif

Added: sandbox/interthreads/boost/interthreads/algorithm/get_all_until.hpp
==============================================================================
--- (empty file)
+++ sandbox/interthreads/boost/interthreads/algorithm/get_all_until.hpp 2009-01-04 13:05:36 EST (Sun, 04 Jan 2009)
@@ -0,0 +1,99 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2008. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/interthreads for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTERTHREADS_GET_ALL_UNTIL__HPP
+#define BOOST_INTERTHREADS_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/chono/chono.hpp>
+#else
+#include <boost/thread/thread_time.hpp>
+#endif
+#include <boost/interthreads/algorithm/get_all.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace interthreads {
+
+ 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 act.get_until(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 act.get_until(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::get_all_until<Sequence>
+ 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::get_all_for<Sequence>
+ get_all_for(Sequence& t, const Duration& rel_time) {
+ return get_all_until(t, get_system_time()+rel_time);
+ }
+
+
+}
+} // namespace boost
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif

Added: sandbox/interthreads/boost/interthreads/algorithm/interrupt_all.hpp
==============================================================================
--- (empty file)
+++ sandbox/interthreads/boost/interthreads/algorithm/interrupt_all.hpp 2009-01-04 13:05:36 EST (Sun, 04 Jan 2009)
@@ -0,0 +1,47 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2008. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/interthreads for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTERTHREADS_INTERRUPT_ALL__HPP
+#define BOOST_INTERTHREADS_INTERRUPT_ALL__HPP
+
+#include <boost/fusion/include/for_each.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace interthreads {
+
+ namespace fct {
+ struct interrupt {
+ template<typename ACT>
+ void operator()(ACT& act) const {
+ act.interrupt();
+ }
+ };
+ }
+
+ 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/interthreads/boost/interthreads/algorithm/interruption_requested_on_all.hpp
==============================================================================
--- (empty file)
+++ sandbox/interthreads/boost/interthreads/algorithm/interruption_requested_on_all.hpp 2009-01-04 13:05:36 EST (Sun, 04 Jan 2009)
@@ -0,0 +1,50 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2008. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/interthreads for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTERTHREADS_INTERRUPTION_REQUESTED_ON_ALL__HPP
+#define BOOST_INTERTHREADS_INTERRUPTION_REQUESTED_ON_ALL__HPP
+
+#include <boost/fusion/include/all.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace interthreads {
+
+ namespace fct {
+ struct interruption_requested {
+ typedef bool result_type;
+
+ template<typename ACT>
+ bool operator()(ACT& act) const {
+ return act.interruption_requested();
+ }
+ };
+ }
+
+ 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/interthreads/boost/interthreads/algorithm/join_all.hpp
==============================================================================
--- (empty file)
+++ sandbox/interthreads/boost/interthreads/algorithm/join_all.hpp 2009-01-04 13:05:36 EST (Sun, 04 Jan 2009)
@@ -0,0 +1,55 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2008. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/interthreads for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTERTHREADS_JOIN_ALL__HPP
+#define BOOST_INTERTHREADS_JOIN_ALL__HPP
+
+#include <boost/fusion/include/for_each.hpp>
+
+#ifdef BOOST_HAS_CHRONO_LIB
+#include <boost/chono/chono.hpp>
+#else
+#include <boost/thread/thread_time.hpp>
+#endif
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace interthreads {
+
+ namespace fct {
+ struct join {
+ typedef void result_type;
+ template<typename ACT>
+ void operator()(ACT& act) const {
+ act.join();
+ }
+ };
+ }
+
+ 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/interthreads/boost/interthreads/algorithm/join_all_until.hpp
==============================================================================
--- (empty file)
+++ sandbox/interthreads/boost/interthreads/algorithm/join_all_until.hpp 2009-01-04 13:05:36 EST (Sun, 04 Jan 2009)
@@ -0,0 +1,91 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2008. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/interthreads for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTERTHREADS_JOIN_ALL_UNTIL__HPP
+#define BOOST_INTERTHREADS_JOIN_ALL_UNTIL__HPP
+
+#include <boost/fusion/include/transform.hpp>
+
+#ifdef BOOST_HAS_CHRONO_LIB
+#include <boost/chono/chono.hpp>
+#else
+#include <boost/thread/thread_time.hpp>
+#endif
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace interthreads {
+
+ 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 act.join_until(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 act.join_until(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;
+ };
+ }
+
+
+ template <typename Sequence>
+ typename result_of::join_all_until<Sequence>
+ join_all_until(Sequence& t, const system_time& abs_time) {
+ 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 get_all_until(fusion::pop_front(t));
+ }
+ }
+ }
+
+ template <typename Sequence, typename Duration>
+ typename result_of::join_all_for<Sequence>
+ join_all_for(Sequence& t, const Duration& rel_time) {
+ return join_all_until(t, get_system_time()+rel_time);
+ }
+
+}
+} // namespace boost
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif

Added: sandbox/interthreads/boost/interthreads/algorithm/wait_all.hpp
==============================================================================
--- (empty file)
+++ sandbox/interthreads/boost/interthreads/algorithm/wait_all.hpp 2009-01-04 13:05:36 EST (Sun, 04 Jan 2009)
@@ -0,0 +1,55 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2008. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/interthreads for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTERTHREADS_WAIT_ALL__HPP
+#define BOOST_INTERTHREADS_WAIT_ALL__HPP
+
+#include <boost/fusion/include/for_each.hpp>
+
+#ifdef BOOST_HAS_CHRONO_LIB
+#include <boost/chono/chono.hpp>
+#else
+#include <boost/thread/thread_time.hpp>
+#endif
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace interthreads {
+
+ namespace fct {
+ struct wait {
+ typedef void result_type;
+ template<typename ACT>
+ void operator()(ACT& act) const {
+ act.wait();
+ }
+ };
+ }
+
+ 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 result_of::wait_all<Sequence>::type
+ wait_all(Sequence& t) {
+ return fusion::for_each(t, fct::wait());
+ }
+
+}
+} // namespace boost
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif

Added: sandbox/interthreads/boost/interthreads/algorithm/wait_all_until.hpp
==============================================================================
--- (empty file)
+++ sandbox/interthreads/boost/interthreads/algorithm/wait_all_until.hpp 2009-01-04 13:05:36 EST (Sun, 04 Jan 2009)
@@ -0,0 +1,92 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2008. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/interthreads for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTERTHREADS_WAIT_ALL_UNTIL__HPP
+#define BOOST_INTERTHREADS_WAIT_ALL_UNTIL__HPP
+
+#include <boost/fusion/include/transform.hpp>
+
+#ifdef BOOST_HAS_CHRONO_LIB
+#include <boost/chono/chono.hpp>
+#else
+#include <boost/thread/thread_time.hpp>
+#endif
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace interthreads {
+
+ 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 act.wait_until(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 act.wait_until(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;
+ };
+ }
+
+ template <typename Sequence>
+ typename result_of::wait_all_until<Sequence>
+ wait_all_until(Sequence& t, const system_time& abs_time) {
+ bool r = fct::wait_until(abs_time)(fusion::at_c<0>(t));
+ if (r) return true;
+ else {
+ if (fusion::size(t)==1) {
+ return false;
+ } else {
+ return get_all_until(fusion::pop_front(t));
+ }
+ }
+ }
+
+ template <typename Sequence, typename Duration>
+ typename result_of::wait_all_for<Sequence>
+ wait_all_for(Sequence& t, const Duration& rel_time) {
+ return wait_all_until(t, get_system_time()+rel_time);
+ }
+
+
+}
+} // namespace boost
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif

Added: sandbox/interthreads/boost/interthreads/detail/config.hpp
==============================================================================
--- (empty file)
+++ sandbox/interthreads/boost/interthreads/detail/config.hpp 2009-01-04 13:05:36 EST (Sun, 04 Jan 2009)
@@ -0,0 +1,94 @@
+// Copyright (C) 2001-2003
+// William E. Kempf
+//
+// 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)
+
+#ifndef BOOST_INTERTHREADS_CONFIG_WEK01032003_HPP
+#define BOOST_INTERTHREADS_CONFIG_WEK01032003_HPP
+
+#include <boost/config.hpp>
+#include <boost/detail/workaround.hpp>
+
+#if BOOST_WORKAROUND(__BORLANDC__, < 0x600)
+# pragma warn -8008 // Condition always true/false
+# pragma warn -8080 // Identifier declared but never used
+# pragma warn -8057 // Parameter never used
+# pragma warn -8066 // Unreachable code
+#endif
+
+#include "platform.hpp"
+
+// compatibility with the rest of Boost's auto-linking code:
+#if defined(BOOST_INTERTHREADS_DYN_DLL) || defined(BOOST_ALL_DYN_LINK)
+# undef BOOST_INTERTHREADS_USE_LIB
+# define BOOST_INTERTHREADS_USE_DLL
+#endif
+
+#if defined(BOOST_INTERTHREADS_BUILD_DLL) //Build dll
+#elif defined(BOOST_INTERTHREADS_BUILD_LIB) //Build lib
+#elif defined(BOOST_INTERTHREADS_USE_DLL) //Use dll
+#elif defined(BOOST_INTERTHREADS_USE_LIB) //Use lib
+#else //Use default
+# if defined(BOOST_INTERTHREADS_PLATFORM_WIN32)
+# if defined(BOOST_MSVC) || defined(BOOST_INTEL_WIN)
+ //For compilers supporting auto-tss cleanup
+ //with Boost.Threads lib, use Boost.Threads lib
+# define BOOST_INTERTHREADS_USE_LIB
+# else
+ //For compilers not yet supporting auto-tss cleanup
+ //with Boost.Threads lib, use Boost.Threads dll
+# define BOOST_INTERTHREADS_USE_DLL
+# endif
+# else
+# define BOOST_INTERTHREADS_USE_LIB
+# endif
+#endif
+
+#if defined(BOOST_HAS_DECLSPEC)
+# if defined(BOOST_INTERTHREADS_BUILD_DLL) //Build dll
+# define BOOST_INTERTHREADS_DECL __declspec(dllexport)
+# elif defined(BOOST_INTERTHREADS_USE_DLL) //Use dll
+# define BOOST_INTERTHREADS_DECL __declspec(dllimport)
+# else
+# define BOOST_INTERTHREADS_DECL
+# endif
+#else
+# define BOOST_INTERTHREADS_DECL
+#endif // BOOST_HAS_DECLSPEC
+
+//
+// Automatically link to the correct build variant where possible.
+//
+#if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_INTERTHREADS_NO_LIB) && !defined(BOOST_INTERTHREADS_BUILD_DLL) && !defined(BOOST_INTERTHREADS_BUILD_LIB)
+//
+// Tell the autolink to link dynamically, this will get undef'ed by auto_link.hpp
+// once it's done with it:
+//
+#if defined(BOOST_INTERTHREADS_USE_DLL)
+# define BOOST_DYN_LINK
+#endif
+//
+// Set the name of our library, this will get undef'ed by auto_link.hpp
+// once it's done with it:
+//
+#if defined(BOOST_INTERTHREADS_LIB_NAME)
+# define BOOST_LIB_NAME BOOST_INTERTHREADS_LIB_NAME
+#else
+# define BOOST_LIB_NAME boost_thread
+#endif
+//
+// If we're importing code from a dll, then tell auto_link.hpp about it:
+//
+// And include the header that does the work:
+//
+#include <boost/config/auto_link.hpp>
+#endif // auto-linking disabled
+
+#endif // BOOST_INTERTHREADS_CONFIG_WEK1032003_HPP
+
+// Change Log:
+// 22 Jan 05 Roland Schwarz (speedsnail)
+// Usage of BOOST_HAS_DECLSPEC macro.
+// Default again is static lib usage.
+// BOOST_DYN_LINK only defined when autolink included.

Added: sandbox/interthreads/boost/interthreads/detail/platform.hpp
==============================================================================
--- (empty file)
+++ sandbox/interthreads/boost/interthreads/detail/platform.hpp 2009-01-04 13:05:36 EST (Sun, 04 Jan 2009)
@@ -0,0 +1,71 @@
+// Copyright 2006 Roland Schwarz.
+// (C) Copyright 2007 Anthony Williams
+// 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)
+//
+// This work is a reimplementation along the design and ideas
+// of William E. Kempf.
+
+#ifndef BOOST_INTERTHREADS_RS06040501_HPP
+#define BOOST_INTERTHREADS_RS06040501_HPP
+
+// fetch compiler and platform configuration
+#include <boost/config.hpp>
+
+// insist on threading support being available:
+#include <boost/config/requires_threads.hpp>
+
+// choose platform
+#if defined(linux) || defined(__linux) || defined(__linux__)
+# define BOOST_INTERTHREADS_LINUX
+#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
+# define BOOST_INTERTHREADS_BSD
+#elif defined(sun) || defined(__sun)
+# define BOOST_INTERTHREADS_SOLARIS
+#elif defined(__sgi)
+# define BOOST_INTERTHREADS_IRIX
+#elif defined(__hpux)
+# define BOOST_INTERTHREADS_HPUX
+#elif defined(__CYGWIN__)
+# define BOOST_INTERTHREADS_CYGWIN
+#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
+# define BOOST_INTERTHREADS_WIN32
+#elif defined(__BEOS__)
+# define BOOST_INTERTHREADS_BEOS
+#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
+# define BOOST_INTERTHREADS_MACOS
+#elif defined(__IBMCPP__) || defined(_AIX)
+# define BOOST_INTERTHREADS_AIX
+#elif defined(__amigaos__)
+# define BOOST_INTERTHREADS_AMIGAOS
+#elif defined(__QNXNTO__)
+# define BOOST_INTERTHREADS_QNXNTO
+#elif defined(unix) || defined(__unix) || defined(_XOPEN_SOURCE) || defined(_POSIX_SOURCE)
+# if defined(BOOST_HAS_PTHREADS) && !defined(BOOST_INTERTHREADS_POSIX)
+# define BOOST_INTERTHREADS_POSIX
+# endif
+#endif
+
+// For every supported platform add a new entry into the dispatch table below.
+// BOOST_INTERTHREADS_POSIX is tested first, so on platforms where posix and native
+// threading is available, the user may choose, by defining BOOST_INTERTHREADS_POSIX
+// in her source. If a platform is known to support pthreads and no native
+// port of boost_thread is available just specify "pthread" in the
+// dispatcher table. If there is no entry for a platform but pthreads is
+// available on the platform, pthread is choosen as default. If nothing is
+// available the preprocessor will fail with a diagnostic message.
+
+#if defined(BOOST_INTERTHREADS_POSIX)
+# define BOOST_INTERTHREADS_PLATFORM_PTHREAD
+#else
+# if defined(BOOST_INTERTHREADS_WIN32)
+# define BOOST_INTERTHREADS_PLATFORM_WIN32
+# elif defined(BOOST_HAS_PTHREADS)
+# define BOOST_INTERTHREADS_PLATFORM_PTHREAD
+# else
+# error "Sorry, no boost threads are available for this platform."
+# endif
+#endif
+
+#endif // BOOST_INTERTHREADS_RS06040501_HPP

Modified: sandbox/interthreads/boost/interthreads/set_once.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/set_once.hpp (original)
+++ sandbox/interthreads/boost/interthreads/set_once.hpp 2009-01-04 13:05:36 EST (Sun, 04 Jan 2009)
@@ -17,7 +17,11 @@
 #include <boost/thread/thread_time.hpp>
 #include <boost/thread/mutex.hpp>
 #include <boost/thread/condition_variable.hpp>
+#include <boost/utility/result_of.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/is_void.hpp>
 #include <utility>
+#include <boost/config/abi_prefix.hpp>
 
 namespace boost {
 namespace interthreads {
@@ -33,38 +37,65 @@
         void wait() {
             boost::unique_lock<boost::mutex> lock(mutex_);
             if (!assigned_) cond_.wait(lock);
+ assigned_=false;
+ }
+ bool wait_until(const system_time& until) {
+ boost::unique_lock<boost::mutex> lock(mutex_);
+ bool res = assigned_;
+ if (!assigned_) res = cond_.timed_wait(lock, until);
+ assigned_=false;
+ return res;
         }
         value_type get() {
             boost::unique_lock<boost::mutex> lock(mutex_);
             if (!assigned_) cond_.wait(lock);
- return id_;
+ assigned_=false;
+ return val_;
         }
         
- std::pair<bool,value_type> timed_get(const system_time& wait_until) {
+ std::pair<bool,value_type> get_until(const system_time& until) {
             boost::unique_lock<boost::mutex> lock(mutex_);
             bool res = assigned_;
- if (!assigned_) res = cond_.timed_wait(lock, wait_until);
- return std::make_pair(res, id_);
+ if (!assigned_) res = cond_.timed_wait(lock, until);
+ assigned_=false;
+ return std::make_pair(res, val_);
         }
 
- bool set(value_type id) {
+ bool set_value_if_unassigned(value_type val) {
             boost::unique_lock<boost::mutex> lock(mutex_);
             if (!assigned_) { /*< first post assigns the current thread id >*/
                     assigned_=true;
- id_ = id;
+ val_ = val;
                     cond_.notify_all();
                     return true;
- } else { /*< the other post do nothing >*/
+ } else { /*< the other settings are ignored >*/
                     return false;
             }
         }
         
         template<typename F>
- static void decorator(this_type& once, T value, F fct) {
+ //static typename boost::enable_if<is_void<typename result_of<F()>::type>,void>::type
+ void
+ decorator(this_type& once, T value, F fct) {
                     fct();
- once.set(value);
+ once.set_value_if_unassigned(value);
+ }
+
+ template<typename F>
+ //static typename boost::disable_if<is_void<typename result_of<F()>::type>, typename result_of<F()>::type>::type
+ typename result_of<F()>::type
+ decoratorT(this_type& once, T value, F fct) {
+ typename result_of<F()>::type res =fct();
+ once.set_value_if_unassigned(value);
+ return res;
         }
         template<typename F>
+ boost::detail::thread_move_t<thread> fork(T value, F fct) {
+ thread tmp_thread(bind(decorator<F>, ref(*this), value, fct));
+ return tmp_thread;
+ }
+
+ template<typename F>
         static boost::detail::thread_move_t<thread> make_thread(this_type& once, T value, F fct) {
             thread tmp_thread(bind(decorator<F>, ref(once), value, fct));
             return tmp_thread;
@@ -74,10 +105,11 @@
         mutex mutex_;
         condition_variable cond_;
         bool assigned_;
- value_type id_;
+ value_type val_;
     };
 }
 } // namespace boost
+#include <boost/config/abi_suffix.hpp>
 
 #endif
 

Modified: sandbox/interthreads/boost/interthreads/thread_and_join.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/thread_and_join.hpp (original)
+++ sandbox/interthreads/boost/interthreads/thread_and_join.hpp 2009-01-04 13:05:36 EST (Sun, 04 Jan 2009)
@@ -18,100 +18,125 @@
 #include <boost/interthreads/thread_tuple.hpp>
 #include <boost/interthreads/thread_tuple_once.hpp>
 #include <utility>
+#include <boost/config/abi_prefix.hpp>
 
 namespace boost {
 namespace interthreads {
 
+#if 0
+template <typename F>
+struct par {
+
+};
+
+par(f1) || f2
+
+#endif
+
     template<typename F1, typename F2>
- inline void thread_and_join_all(F1 f1, F2 f2)
+ inline void conc_join_all(F1 f1, F2 f2)
     {
             thread_tuple<2> stg(f1, f2);
             stg.join_all();
     }
+
+#if 0
+ template<typename F0, typename F1>
+ tuple<
+ typename result_of<F0()>::type
+ , typename result_of<F1()>::type
+ >
+ conc_all(F0 f0, F1 f1)
+ {
+ future_tuple<typename result_of<F0()>::type, typename result_of<F1()>::type > ft(f0, f1);
+ return ft.get_all();
+ }
+#endif
+
     template<typename F1, typename F2, typename F3>
- inline void thread_and_join_all(F1 f1, F2 f2, F3 f3)
+ inline void conc_join_all(F1 f1, F2 f2, F3 f3)
     {
             thread_tuple<3> stg(f1, f2, f3);
             stg.join_all();
     }
 
     template<typename F1, typename F2>
- inline void thread_and_timed_join_all(const system_time& wait_until, F1 f1, F2 f2)
+ inline void conc_join_all_until(const system_time& wait_until, F1 f1, F2 f2)
     {
             thread_tuple<2> stg(f1, f2);
- stg.timed_join_all(wait_until);
+ stg.join_all_until(wait_until);
     }
     
     template<typename F1, typename F2, typename F3>
- inline void thread_and_timed_join_first_all(const system_time& wait_until, F1 f1, F2 f2, F3 f3)
+ inline void conc_join_all_until(const system_time& wait_until, F1 f1, F2 f2, F3 f3)
     {
             thread_tuple<3> stg(f1, f2, f3);
- stg.timed_join_all(wait_until);
+ stg.join_all_until(wait_until);
     }
     
     template<typename TimeDuration, typename F1, typename F2>
- inline std::size_t thread_and_timed_join_all(TimeDuration wait_for, F1 f1, F2 f2)
+ inline std::size_t conc_join_all_for(TimeDuration wait_for, F1 f1, F2 f2)
     {
- return thread_and_timed_join_all(get_system_time()+wait_for, f1, f2);
+ return conc_join_all_until(get_system_time()+wait_for, f1, f2);
     }
     
     template<typename TimeDuration, typename F1, typename F2, typename F3>
- inline std::size_t thread_and_join_all(TimeDuration wait_for, F1 f1, F2 f2, F3 f3)
+ inline std::size_t conc_join_all_for(TimeDuration wait_for, F1 f1, F2 f2, F3 f3)
     {
- return thread_and_timed_join_all(get_system_time()+wait_for, f1, f2, f3);
+ return conc_join_all_until(get_system_time()+wait_for, f1, f2, f3);
     }
     
     
-
     template<typename F1, typename F2>
- inline std::size_t thread_and_join_first_then_interrupt(F1 f1, F2 f2)
+ inline std::size_t conc_join_any(F1 f1, F2 f2)
     {
             thread_tuple_once<2> stg(f1, f2);
- std::size_t res= stg.join_first();
+ std::size_t res= stg.join_any();
             stg.interrupt_all();
         return res;
     }
     
     template<typename F1, typename F2, typename F3>
- inline std::size_t thread_and_join_first_then_interrupt(F1 f1, F2 f2, F3 f3)
+ inline std::size_t conc_join_any(F1 f1, F2 f2, F3 f3)
     {
             thread_tuple_once<3> stg(f1, f2, f3);
- std::size_t res= stg.join_first();
+ std::size_t res= stg.join_any();
             stg.interrupt_all();
         return res;
     }
 
     template<typename F1, typename F2>
- inline std::size_t thread_and_timed_join_first_then_interrupt(const system_time& wait_until, F1 f1, F2 f2)
+ inline std::size_t conc_join_any_until(const system_time& wait_until, F1 f1, F2 f2)
     {
             thread_tuple_once<2> stg(f1, f2);
- std::pair<bool,std::size_t> res= stg.timed_join_first();
+ std::pair<bool,std::size_t> res= stg.join_any_until(wait_until);
         if (res.first) stg.interrupt_all();
         return res;
     }
     
     template<typename F1, typename F2, typename F3>
- inline std::size_t thread_and_timed_join_first_then_interrupt(const system_time& wait_until, F1 f1, F2 f2, F3 f3)
+ inline std::size_t conc_join_any_until(const system_time& wait_until, F1 f1, F2 f2, F3 f3)
     {
             thread_tuple_once<3> stg(f1, f2, f3);
- std::pair<bool,std::size_t> res= stg.join_first();
+ std::pair<bool,std::size_t> res= stg.join_any_until(wait_until);
             if (res.first) stg.interrupt_all();
         return res;
     }
     
     template<typename TimeDuration, typename F1, typename F2>
- inline std::size_t thread_and_timed_join_first_then_interrupt(TimeDuration wait_for, F1 f1, F2 f2)
+ inline std::size_t conc_join_any_for(TimeDuration wait_for, F1 f1, F2 f2)
     {
- return thread_and_timed_join_first_then_interrupt(get_system_time()+wait_for, f1, f2);
+ return conc_join_any_until(get_system_time()+wait_for, f1, f2);
     }
     
     template<typename TimeDuration, typename F1, typename F2, typename F3>
- inline std::size_t thread_and_join_first_then_interrupt(TimeDuration wait_for, F1 f1, F2 f2, F3 f3)
+ inline std::size_t conc_join_any_for(TimeDuration wait_for, F1 f1, F2 f2, F3 f3)
     {
- return thread_and_timed_join_first_then_interrupt(get_system_time()+wait_for, f1, f2, f3);
+ return conc_join_any_until(get_system_time()+wait_for, f1, f2, f3);
     }
 }
 } // namespace boost
 
+#include <boost/config/abi_suffix.hpp>
 
 #endif

Modified: sandbox/interthreads/boost/interthreads/thread_decorator.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/thread_decorator.hpp (original)
+++ sandbox/interthreads/boost/interthreads/thread_decorator.hpp 2009-01-04 13:05:36 EST (Sun, 04 Jan 2009)
@@ -15,15 +15,18 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
+#include <boost/interthreads/detail/config.hpp>
 #include <boost/thread/detail/move.hpp>
 #include <boost/thread/thread.hpp>
 #include <boost/shared_ptr.hpp>
 #include <boost/bind.hpp>
 #include <boost/function.hpp>
+#include <boost/utility/result_of.hpp>
 
-//#define BOOST_INTERTHREADS_THREAD_DECORATION_MOVE
 //#define BOOST_INTERTHREADS_THREAD_DECORATOR_MOVE
 
+#include <boost/config/abi_prefix.hpp>
+
 namespace boost {
 namespace interthreads {
     
@@ -34,7 +37,7 @@
         };
         
         template<typename F>
- struct decorator_function : decorator_function_base {
+ struct BOOST_INTERTHREADS_DECL decorator_function : decorator_function_base {
             F f;
 #ifdef BOOST_INTERTHREADS_THREAD_DECORATION_MOVE
 #ifdef BOOST_HAS_RVALUE_REFS
@@ -122,7 +125,7 @@
              ~thread_decoration() {
             delete setup_;
         }
- static void decorate();
+ static void BOOST_INTERTHREADS_DECL decorate();
 
     private:
         friend class thread_decorator;
@@ -143,7 +146,6 @@
         thread_decorator& operator=(const thread_decorator& other) {
             thread_decorator tmp(other);
             tmp.swap(*this);
-// func_=other.func_;
             return *this;
         }
 
@@ -268,10 +270,22 @@
 
     inline static void decorate() {thread_decoration::decorate();}
   
+ template <typename AE, typename Decorator>
+ struct asynchronous_executor_decorator : AE {
+ //typedef typename boost::result_of<F()>::type result_type;
+ template <typename F>
+ typename AE::template handle< typename boost::result_of<F()>::type >::type
+ fork( F fn ) {
+ return this->AE::fork(Decorator(fn));
+ }
+ };
+
+ //typedef asynchronous_executor_decorator<threader,thread_decorator> threader_decorator;
     
 }
 }
 
+#include <boost/config/abi_suffix.hpp>
 
 
 #endif

Modified: sandbox/interthreads/boost/interthreads/thread_group_once.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/thread_group_once.hpp (original)
+++ sandbox/interthreads/boost/interthreads/thread_group_once.hpp 2009-01-04 13:05:36 EST (Sun, 04 Jan 2009)
@@ -16,6 +16,7 @@
 #include <boost/thread/thread.hpp>
 #include <boost/interthreads/set_once.hpp>
 #include <utility>
+#include <boost/config/abi_prefix.hpp>
 
 namespace boost {
 namespace interthreads {
@@ -26,7 +27,7 @@
             inline thread_group_once() {}
         inline ~thread_group_once() {
 #if 0
- grp().detach();
+ detach_all();
 #endif
         }
 
@@ -42,13 +43,11 @@
             grp().remove_thread(thrd);
         }
 
- void join() {
+ void join_all() {
                 once().wait();
             grp().join_all();
         }
 
- inline void join_all() { join(); }
-
 #if 0
         bool joinable() const {
                 return grp.joinable();
@@ -56,52 +55,42 @@
 #endif
 
 #if 0
- bool timed_join(const system_time& wait_until) {
+ bool join_all_until(const system_time& wait_until) {
                 return grp.timed_join(wait_until);
         }
- inline bool timed_join_all(const system_time& wait_until) {
- return timed_join(wait_until);
- }
 
         template<typename TimeDuration>
- inline bool timed_join(TimeDuration const& rel_time)
+ inline bool join_all_for(TimeDuration const& rel_time)
         {
- return timed_join(get_system_time()+rel_time);
+ return join_all_until(get_system_time()+rel_time);
         }
 
- template<typename TimeDuration>
- inline bool timed_join_all(TimeDuration const& rel_time) {
- return timed_join(rel_time);
- }
 #endif
- thread* join_first() {
+ thread* join_any() {
                 return once().get();
         }
 
- std::pair<bool,thread*> timed_join_first(const system_time& wait_until) {
- return once().timed_get(wait_until);
+ std::pair<bool,thread*> join_any_until(const system_time& wait_until) {
+ return once().get_until(wait_until);
         }
 
         template<typename TimeDuration>
- inline std::pair<bool,thread*> timed_join_first(TimeDuration const& rel_time)
+ inline std::pair<bool,thread*> join_any_for(TimeDuration const& rel_time)
         {
- return timed_join_first(get_system_time()+rel_time);
+ return join_any_until(get_system_time()+rel_time);
         }
 
 #if 0
- void detach() {
+ void detach_all() {
                 grp().detach();
         }
 
- inline void detach_all() { detach(); }
 #endif
             
- void interrupt() {
+ void interrupt_all() {
                 grp().interrupt_all();
         }
 
- inline void interrupt_all() { interrupt(); }
-
 #if 0
         bool interruption_requested() const {
                 grp().interruption_requested();
@@ -128,6 +117,7 @@
 
 }
 } // namespace boost
+#include <boost/config/abi_suffix.hpp>
 
 
 #endif

Modified: sandbox/interthreads/boost/interthreads/thread_keep_alive.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/thread_keep_alive.hpp (original)
+++ sandbox/interthreads/boost/interthreads/thread_keep_alive.hpp 2009-01-04 13:05:36 EST (Sun, 04 Jan 2009)
@@ -12,13 +12,16 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 #include <memory>
-
+#include <boost/interthreads/detail/config.hpp>
 #include <boost/thread/thread.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
 namespace boost {
 namespace interthreads {
     typedef void (*on_dead_thread_type)(thread::id, thread*);
         namespace detail {
- struct thread_keep_alive_internal {
+ struct BOOST_INTERTHREADS_DECL thread_keep_alive_internal {
                         bool enabled_;
                         std::size_t periods_;
                         std::size_t checkins_;
@@ -31,7 +34,7 @@
         }
 namespace this_thread {
 
- class enable_keep_alive
+ class BOOST_INTERTHREADS_DECL enable_keep_alive
     {
             enable_keep_alive(const enable_keep_alive&);
             enable_keep_alive& operator=(const enable_keep_alive&);
@@ -43,7 +46,7 @@
         ~enable_keep_alive();
     };
     
- class disable_keep_alive
+ class BOOST_INTERTHREADS_DECL disable_keep_alive
     {
         disable_keep_alive(const disable_keep_alive&);
         disable_keep_alive& operator=(const disable_keep_alive&);
@@ -55,19 +58,21 @@
         ~disable_keep_alive();
     };
 
- void keep_alive_point();
- bool keep_alive_enabled();
+ void BOOST_INTERTHREADS_DECL keep_alive_point();
+ bool BOOST_INTERTHREADS_DECL keep_alive_enabled();
 
- void set_on_dead_thread(on_dead_thread_type fct, thread* th=0);
+ void BOOST_INTERTHREADS_DECL set_on_dead_thread(on_dead_thread_type fct, thread* th=0);
      
 }
 
- bool keep_alive_enabled(thread::id);
+ bool BOOST_INTERTHREADS_DECL keep_alive_enabled(thread::id);
 
- void set_on_dead_thread(thread::id, on_dead_thread_type fct, thread* th=0);
+ void BOOST_INTERTHREADS_DECL set_on_dead_thread(thread::id, on_dead_thread_type fct, thread* th=0);
 
 }
 }
 
+#include <boost/config/abi_suffix.hpp>
+
 #endif
 

Modified: sandbox/interthreads/boost/interthreads/thread_specific_shared_ptr.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/thread_specific_shared_ptr.hpp (original)
+++ sandbox/interthreads/boost/interthreads/thread_specific_shared_ptr.hpp 2009-01-04 13:05:36 EST (Sun, 04 Jan 2009)
@@ -25,7 +25,7 @@
 #include <boost/thread.hpp>
 #include <map>
 
-//#include <boost/config/abi_prefix.hpp>
+#include <boost/config/abi_prefix.hpp>
 
 namespace boost {
 namespace interthreads {
@@ -217,6 +217,6 @@
 }
 }
 
-//#include <boost/config/abi_suffix.hpp>
+#include <boost/config/abi_suffix.hpp>
 
 #endif

Modified: sandbox/interthreads/boost/interthreads/thread_tuple.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/thread_tuple.hpp (original)
+++ sandbox/interthreads/boost/interthreads/thread_tuple.hpp 2009-01-04 13:05:36 EST (Sun, 04 Jan 2009)
@@ -13,115 +13,270 @@
 
 #include <boost/bind.hpp>
 #include <boost/thread/detail/move.hpp>
+#ifdef BOOST_HAS_MOVE_LIB
+#include <boost/move/move.hpp>
+#endif
+#ifdef BOOST_HAS_CHRONO_LIB
+#include <boost/chono/chono.hpp>
+#endif
 #include <boost/thread/thread_time.hpp>
 #include <boost/thread/thread.hpp>
+#include <boost/array.hpp>
+#include <boost/shared_ptr.hpp>
 #include <utility>
 
+#include <boost/config/abi_prefix.hpp>
+
 namespace boost {
 namespace interthreads {
 
     template <std::size_t N>
     class thread_tuple;
     
+namespace detail {
+
+ template <std::size_t size_>
+ class thread_tuple_storage_stack {
+ typedef thread_tuple_storage_stack<size_> this_type;
+ public:
+ struct thread_tuple_data {
+ array<thread, size_> threads_;
+ };
+ thread_tuple_data data_;
+ thread_tuple_data* data() {return &data_;}
+ thread& threads(std::size_t i) {return data_.threads_[i];}
+
+ // constructors/destructors
+ inline thread_tuple_storage_stack()
+ : data_()
+ {}
+
+#ifdef BOOST_HAS_RVALUE_REFS
+ thread_tuple_storage_stack(this_type&& other)
+ : data_()
+ {
+ for (std::size_t i=0; i<size_; i++) {
+ threads(i) = boost::move(other.data_.threads(i));
+ }
+ }
+
+ this_type&& move() {
+ return static_cast<this_type&&>(*this);
+ }
+#else
+#ifdef BOOST_HAS_MOVE_LIB
+ thread_tuple_storage_stack(move_from<this_type> other)
+ : data_()
+ {
+ for (std::size_t i=0; i<size_; i++) {
+ this->threads(i) = boost::move(other.data_.threads(i));
+ }
+ }
+
+ operator move_from<this_type>() {
+ return move();
+ }
+
+ move_from<this_type> move() {
+ return move_from<this_type>(*this);
+ }
+#else
+ thread_tuple_storage_stack(boost::detail::thread_move_t<this_type> other)
+ : data_()
+ {
+ for (std::size_t i=0; i<size_; i++) {
+ this->threads(i) = boost::move(other.data_.threads(i));
+ }
+ }
+
+ operator boost::detail::thread_move_t<this_type>() {
+ return move();
+ }
+
+ boost::detail::thread_move_t<this_type> move() {
+ return boost::detail::thread_move_t<this_type>(*this);
+ }
+#endif
+#endif
+ inline ~thread_tuple_storage_stack() {
+ }
+ };
+
     template <std::size_t size_>
- class thread_tuple_base
+ class thread_tuple_storage_heap {
+ typedef thread_tuple_storage_heap<size_> this_type;
+ public:
+ struct thread_tuple_data {
+ array<thread, size_> threads_;
+ };
+ shared_ptr<thread_tuple_data> data_;
+ thread_tuple_data* data() {return data_.get();}
+ thread& threads(std::size_t i) {return data_->threads_[i];}
+
+ // constructors/destructors
+ inline thread_tuple_storage_heap()
+ : data_(new thread_tuple_data())
+ {}
+#ifdef BOOST_HAS_RVALUE_REFS
+ thread_tuple_storage_heap(this_type&& other)
+ : data_(other->data_)
+ {
+ other->data_.reset();
+ }
+
+ this_type&& move() {
+ return static_cast<this_type&&>(*this);
+ }
+#else
+ thread_tuple_storage_heap(boost::detail::thread_move_t<this_type> other)
+ : data_(other->data_)
+ {
+ other->data_.reset();
+ }
+
+ operator boost::detail::thread_move_t<this_type>() {
+ return move();
+ }
+
+ boost::detail::thread_move_t<this_type> move() {
+ return boost::detail::thread_move_t<this_type>(*this);
+ }
+#endif
+
+ inline ~thread_tuple_storage_heap() {
+ }
+ void swap(this_type& x)
+ {
+ data_.swap(x.data_);
+ }
+
+ };
+
+ template <std::size_t size_, class STORAGE>
+ class thread_tuple_base : protected STORAGE
     {
+ typedef STORAGE base_type;
+ typedef thread_tuple_base<size_, STORAGE> this_type;
+
     public:
         // constructors/destructors
             inline thread_tuple_base()
- : data_(new thread_tuple_data())
+ : base_type()
         {}
+
+ public:
+#ifdef BOOST_HAS_RVALUE_REFS
+ thread_tuple_base(this_type&& other) {
+ data_.swap(other.data_);
+ }
+
+ this_type&& move() {
+ return static_cast<this_type&&>(*this);
+ }
+#else
+#ifdef BOOST_HAS_MOVE_LIB
+ thread_tuple_base(move_from<this_type> x)
+ : base_type(boost::move(*(static_cast<base_type*>(&(x.member))))) {}
+
+ operator move_from<this_type>() {
+ return move();
+ }
+
+ move_from move() {
+ return move_from<this_type>(*this);
+ }
+#else
+ thread_tuple_base(boost::detail::thread_move_t<this_type> x)
+ : base_type(boost::move(*(static_cast<base_type*>(&(x.t))))) {}
+
+ operator boost::detail::thread_move_t<this_type>() {
+ return move();
+ }
+
+ boost::detail::thread_move_t<this_type> move() {
+ return boost::detail::thread_move_t<this_type>(*this);
+ }
+#endif
+#endif
         inline ~thread_tuple_base() {
- detach();
+ if (this->data()!=0) detach_all();
         }
 
- void join() {
+ bool joinables() const {
                 for (std::size_t i=0; i<size_; i++) {
- threads(i).join();
+ if (!this->threads(i).joinable()) return false;
                 }
+ return true;
         }
 
- inline void join_all() { join(); }
- bool joinable() const {
+ void join_all() {
                 for (std::size_t i=0; i<size_; i++) {
- if (!threads(i).joinable()) return false;
+ this->threads(i).join();
                 }
- return true;
         }
 
- bool timed_join(const system_time& wait_until) {
+ bool join_all_until(const system_time& wait_until) {
                 for (std::size_t i=0; i<size_; i++) {
- if (!threads(i).timed_join(wait_until)) return false;
+ if (!this->threads(i).timed_join(wait_until)) return false;
                 }
                 return true;
         }
- inline bool timed_join_all(const system_time& wait_until) {
- return timed_join(wait_until);
- }
 
         template<typename TimeDuration>
- inline bool timed_join(TimeDuration const& rel_time)
+ inline bool join_all_for(TimeDuration const& rel_time)
         {
- return timed_join(get_system_time()+rel_time);
+ return join_all_until(get_system_time()+rel_time);
         }
 
- template<typename TimeDuration>
- inline bool timed_join_all(TimeDuration const& rel_time) {
- return timed_join(rel_time);
- }
-
- void detach() {
- //if (data_.get()==0) return;
+ void detach_all() {
                 for (std::size_t i=0; i<size_; i++) {
- threads(i).detach();
+ this->threads(i).detach();
                 }
         }
- inline void detach_all() { detach(); }
             
- void interrupt() {
+ void interrupt_all() {
                 for (std::size_t i=0; i<size_; i++) {
- threads(i).interrupt();
+ this->threads(i).interrupt();
                 }
         }
 
- inline void interrupt_all() { interrupt(); }
-
         bool interruption_requested() const {
                 for (std::size_t i=0; i<size_; i++) {
- if (threads(i).interruption_requested()) return true;
+ if (!this->threads(i).interruption_requested()) return false;
                 }
- return false;
+ return true;
         }
         
         inline std::size_t size() const { return size_; }
         
         inline thread& operator[](std::size_t i) const {
- return *threads(i);
+ return this->threads(i);
         }
 
     private:
             thread_tuple_base(thread_tuple_base&);
         thread_tuple_base& operator=(thread_tuple_base&);
- protected:
- struct thread_tuple_data {
- thread threads_[size_];
- };
- shared_ptr<thread_tuple_data> data_;
- thread& threads(std::size_t i) {return data_->threads_[i];}
+// protected:
+// struct thread_tuple_data {
+// array<thread, size_> threads_;
+// };
+// shared_ptr<thread_tuple_data> data_;
+// thread& threads(std::size_t i) {return data_->threads_[i];}
         
     };
-
+}
+
     template <>
- class thread_tuple<2>: public thread_tuple_base<2> {
- typedef thread_tuple_base<2> base_type;
+ class thread_tuple<2>: public detail::thread_tuple_base<2, detail::thread_tuple_storage_heap<2> > {
+ typedef detail::thread_tuple_base<2, detail::thread_tuple_storage_heap<2> > base_type;
         typedef thread_tuple<2> this_type;
     public:
             inline thread_tuple() {}
             
         template<typename F0, typename F1>
             inline thread_tuple(F0 f0, F1 f1) {
- data_->threads_[0] = thread(f0);
- data_->threads_[1] = thread(f1);
+ this->threads(0) = thread(f0);
+ this->threads(1) = thread(f1);
             }
 
         // move support
@@ -136,16 +291,44 @@
         }
 
         this_type&& move() {
- return static_cast<thread&&>(*this);
+ return static_cast<this_type&&>(*this);
         }
-#else
- thread_tuple(boost::detail::thread_move_t<this_type> x) {
- data_=x->data_;
- x->data_.reset(new thread_tuple_data());
+#else
+#ifdef BOOST_HAS_MOVE_LIB
+ thread_tuple(move_from<this_type> x)
+ : base_type(boost::move(static_cast<base_type*>(&(x.member)))) {}
+
+ this_type& operator=(this_type& rhs) {
+ this_type new_thread_tuple(rhs);
+ swap(new_thread_tuple);
+ return *this;
         }
-
- this_type& operator=(boost::detail::thread_move_t<this_type> x) {
- this_type new_thread_tuple(x);
+
+ this_type& operator=(move_from<this_type> rhs) {
+ this_type new_thread_tuple(rhs);
+ swap(new_thread_tuple);
+ return *this;
+ }
+
+ operator move_from<this_type>() {
+ return move();
+ }
+
+ move_from<this_type> move() {
+ return move_from<this_type>(*this);
+ }
+#else
+ thread_tuple(boost::detail::thread_move_t<this_type> x)
+ : base_type(boost::move(*(static_cast<base_type*>(&(x.t))))) {}
+
+ this_type& operator=(this_type& rhs) {
+ this_type new_thread_tuple(boost::move(rhs));
+ swap(new_thread_tuple);
+ return *this;
+ }
+
+ this_type& operator=(boost::detail::thread_move_t<this_type> rhs) {
+ this_type new_thread_tuple(rhs);
             swap(new_thread_tuple);
             return *this;
         }
@@ -157,28 +340,26 @@
         boost::detail::thread_move_t<this_type> move() {
             return boost::detail::thread_move_t<this_type>(*this);
         }
-
-#endif
+#endif
+#endif
         
- void swap(this_type& x)
- {
- data_.swap(x.data_);
- }
+ void swap(this_type& x) { base_type::swap(x); }
         
     };
 
     template <>
- class thread_tuple<3>: public thread_tuple_base<3> {
- typedef thread_tuple_base<3> base_type;
+ class thread_tuple<3>: public detail::thread_tuple_base<3, detail::thread_tuple_storage_heap<3> > {
+ typedef detail::thread_tuple_base<3, detail::thread_tuple_storage_heap<3> > base_type;
         typedef thread_tuple<3> this_type;
     public:
             thread_tuple() {}
         template<typename F0, typename F1, typename F2>
- inline thread_tuple(F0 f0, F1 f1, F2 f2) {
- data_->threads_[0] = thread(f0);
- data_->threads_[1] = thread(f1);
- data_->threads_[2] = thread(f2);
- }
+ inline thread_tuple(F0 f0, F1 f1, F2 f2)
+ {
+ this->threads(0) = thread(f0);
+ this->threads(1) = thread(f1);
+ this->threads(2) = thread(f2);
+ }
         // move support
 #ifdef BOOST_HAS_RVALUE_REFS
         thread_tuple(this_type&& other) {
@@ -229,12 +410,12 @@
     template<typename F0, typename F1, typename F2>
     thread_tuple<3> make_thread_tuple(F0 f0, F1 f1, F2 f2) {
         return thread_tuple<3>(f0, f1, f2);
-
     }
     
 
 }
 } // namespace boost
 
+#include <boost/config/abi_suffix.hpp>
 
 #endif

Modified: sandbox/interthreads/boost/interthreads/thread_tuple_once.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/thread_tuple_once.hpp (original)
+++ sandbox/interthreads/boost/interthreads/thread_tuple_once.hpp 2009-01-04 13:05:36 EST (Sun, 04 Jan 2009)
@@ -16,6 +16,7 @@
 #include <boost/thread/thread.hpp>
 #include <boost/interthreads/set_once.hpp>
 #include <utility>
+#include <boost/config/abi_prefix.hpp>
 
 namespace boost {
 namespace interthreads {
@@ -31,75 +32,64 @@
             : data_(new thread_tuple_once_data())
         {}
         inline ~thread_tuple_once_base() {
- detach();
+ detach_all();
         }
 
- void join() {
- once().wait();
+ bool joinable() const {
                 for (std::size_t i=0; i<size_; i++) {
- threads(i).join();
+ if (!threads(i).joinable()) return false;
                 }
+ return true;
         }
 
- inline void join_all() { join(); }
- bool joinable() const {
+ void join_all() {
+ once().wait();
                 for (std::size_t i=0; i<size_; i++) {
- if (!threads(i).joinable()) return false;
+ threads(i).join();
                 }
- return true;
         }
 
- bool timed_join(const system_time& wait_until) {
- std::pair<bool,std::size_t> succeed = once().timed_get(wait_until);
+ bool join_all_until(const system_time& wait_until) {
+ std::pair<bool,std::size_t> succeed = once().get_until(wait_until);
             if (!succeed.first) return false;
                 for (std::size_t i=0; i<size_; i++) {
                         if (!threads(i).timed_join(wait_until)) return false;
                 }
                 return true;
         }
- inline bool timed_join_all(const system_time& wait_until) {
- return timed_join(wait_until);
- }
 
         template<typename TimeDuration>
- inline bool timed_join(TimeDuration const& rel_time)
+ inline bool join_all_for(TimeDuration const& rel_time)
         {
- return timed_join(get_system_time()+rel_time);
+ return join_all_until(get_system_time()+rel_time);
         }
 
- template<typename TimeDuration>
- inline bool timed_join_all(TimeDuration const& rel_time) {
- return timed_join(rel_time);
- }
 
- std::size_t join_first() {
+ std::size_t join_any() {
                 return once().get();
         }
- std::pair<bool,std::size_t> timed_join_first(const system_time& wait_until) {
- return once().timed_get(wait_until);
+ std::pair<bool,std::size_t> join_any_until(const system_time& wait_until) {
+ return once().get_until(wait_until);
         }
 
         template<typename TimeDuration>
- inline std::pair<bool,std::size_t> timed_join_first(TimeDuration const& rel_time)
+ inline std::pair<bool,std::size_t> join_any_for(TimeDuration const& rel_time)
         {
- return timed_join_first(get_system_time()+rel_time);
+ return join_any_until(get_system_time()+rel_time);
         }
 
- void detach() {
+ void detach_all() {
                 for (std::size_t i=0; i<size_; i++) {
                         threads(i).detach();
                 }
         }
- inline void detach_all() { detach(); }
             
- void interrupt() {
+ void interrupt_all() {
                 for (std::size_t i=0; i<size_; i++) {
                         threads(i).interrupt();
                 }
         }
 
- inline void interrupt_all() { interrupt(); }
-
         bool interruption_requested() const {
                 for (std::size_t i=0; i<size_; i++) {
                         if (threads(i).interruption_requested()) return true;
@@ -136,7 +126,7 @@
         template<typename F0, typename F1>
             inline thread_tuple_once(F0 f0, F1 f1) {
             data_->threads_[0] = base_type::set_once_type::make_thread(once(), 0, f0);
- data_->threads_[1] = base_type::set_once_type::make_thread(once(), 1, f1);
+ data_->threads_[1] = base_type::set_once_type::make_thread(once(), 1, f1);
             }
     };
 
@@ -147,8 +137,8 @@
         template<typename F0, typename F1, typename F2>
             inline thread_tuple_once(F0 f0, F1 f1, F2 f2) {
             data_->threads_[0] = base_type::set_once_type::make_thread(once(), 0, f0);
- data_->threads_[1] = base_type::set_once_type::make_thread(once(), 1, f1);
- data_->threads_[2] = base_type::set_once_type::make_thread(once(), 2, f2);
+ data_->threads_[1] = base_type::set_once_type::make_thread(once(), 1, f1);
+ data_->threads_[2] = base_type::set_once_type::make_thread(once(), 2, f2);
             }
     };
 
@@ -156,5 +146,6 @@
 }
 } // namespace boost
 
+#include <boost/config/abi_suffix.hpp>
 
 #endif


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk