|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r51106 - sandbox/interthreads/boost/interthreads/detail
From: vicente.botet_at_[hidden]
Date: 2009-02-08 16:01:48
Author: viboes
Date: 2009-02-08 16:01:47 EST (Sun, 08 Feb 2009)
New Revision: 51106
URL: http://svn.boost.org/trac/boost/changeset/51106
Log:
interthreads version 0.4
* New free functions for all the AsynchronousCompletionToken operations, providing a higher degree of freedom.
* Missing have_all_values(), have_all_exception() and are_all_ready() functions on AsynchronousCompletionToken fusion tuples.
* get_all: getting all the values from a tuple of AsynchronousCompletionToken works now.
* fork_after overloaded for a single dependency
* wait_all overloaded for a single ACT.
* wait_for_all evaluate one of its elements on the current thread
* No need to use wait_and_get() on thread_specific_shared_ptr<> to synchronize with the decoration if the thread is created using a AsynchronousExecutor decorator. In this case the synchro is done before returning the AsynchronousCompletionToken. See the tutorial and the mono_thread_id example.
Added:
sandbox/interthreads/boost/interthreads/detail/wait_decorator_function.hpp (contents, props changed)
Text files modified:
sandbox/interthreads/boost/interthreads/detail/config.hpp | 4 +-
sandbox/interthreads/boost/interthreads/detail/decorator_function.hpp | 63 +++++++--------------------------------
sandbox/interthreads/boost/interthreads/detail/platform.hpp | 2
3 files changed, 15 insertions(+), 54 deletions(-)
Modified: sandbox/interthreads/boost/interthreads/detail/config.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/detail/config.hpp (original)
+++ sandbox/interthreads/boost/interthreads/detail/config.hpp 2009-02-08 16:01:47 EST (Sun, 08 Feb 2009)
@@ -1,7 +1,7 @@
// Copyright (C) 2001-2003
// William E. Kempf
//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// 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
@@ -63,7 +63,7 @@
#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:
+// once it's done with it:
//
#if defined(BOOST_INTERTHREADS_USE_DLL)
# define BOOST_DYN_LINK
Modified: sandbox/interthreads/boost/interthreads/detail/decorator_function.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/detail/decorator_function.hpp (original)
+++ sandbox/interthreads/boost/interthreads/detail/decorator_function.hpp 2009-02-08 16:01:47 EST (Sun, 08 Feb 2009)
@@ -3,9 +3,9 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Vicente J. Botet Escriba 2008-20009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// (C) Copyright Vicente J. Botet Escriba 2008-2009.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
// copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/interthreads for documentation.
@@ -32,69 +32,30 @@
virtual ~decorator_function_base() {}
virtual T operator()() const=0;
};
-
+
template<typename F>
struct BOOST_INTERTHREADS_DECL decorator_function : decorator_function_base<typename boost::result_of<F()>::type> {
- F f;
-
-#ifdef BOOST_INTERTHREADS_THREAD_DECORATION_MOVE
-#ifdef BOOST_HAS_RVALUE_REFS
- decorator_function(F&& f_):
- f(static_cast<F&&>(f_))
- {}
-#else
- decorator_function(F f_): f(f_) {}
- decorator_function(boost::detail::thread_move_t<F> f_): f(f_) {}
-#endif
-#else
- decorator_function(F f_): f(f_) {}
-#endif
-
+ F f_;
+
+ decorator_function(F f)
+ : f_(f)
+ {}
+
typename boost::result_of<F()>::type operator()() const {
- return f();
+ return f_();
}
private:
decorator_function();
-
+
};
-
-#ifdef BOOST_INTERTHREADS_THREAD_DECORATOR_MOVE
-#ifdef BOOST_HAS_RVALUE_REFS
- template<typename F>
- static inline boost::shared_ptr<decorator_function_base<typename boost::result_of<F()>::type> > make_decorator_function(F&& f)
- {
- return boost::shared_ptr<decorator_function_base>(
- new decorator_function<typename boost::remove_reference<F>::type> >(static_cast<F&&>(f)));
- }
- static inline boost::shared_ptr<decorator_function_base<typename boost::result_of<F()>::type> > make_decorator_function(void (*f)())
- {
- return boost::shared_ptr<decorator_function_base<typename boost::result_of<F()>::type> >(new decorator_function<void(*)()> >(f));
- }
-#else
- struct dummy;
template<typename F>
static inline boost::shared_ptr<decorator_function_base<typename boost::result_of<F()>::type> > make_decorator_function(F f)
{
return boost::shared_ptr<decorator_function_base<typename boost::result_of<F()>::type> >(new decorator_function<F>(f));
}
- template<typename F>
- static inline boost::shared_ptr<decorator_function_base<typename boost::result_of<F()>::type> > make_decorator_function(boost::detail::thread_move_t<F> f)
- {
- return boost::shared_ptr<decorator_function_base<typename boost::result_of<F()>::type> >(new decorator_function<F>(f));
- }
-#endif
-#else
- template<typename F>
- static inline boost::shared_ptr<decorator_function_base<typename boost::result_of<F()>::type> > make_decorator_function(F f)
- {
- return boost::shared_ptr<decorator_function_base<typename boost::result_of<F()>::type> >(new decorator_function<F>(f));
- }
-
-#endif
}
-
}
}
Modified: sandbox/interthreads/boost/interthreads/detail/platform.hpp
==============================================================================
--- sandbox/interthreads/boost/interthreads/detail/platform.hpp (original)
+++ sandbox/interthreads/boost/interthreads/detail/platform.hpp 2009-02-08 16:01:47 EST (Sun, 08 Feb 2009)
@@ -55,7 +55,7 @@
// 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
Added: sandbox/interthreads/boost/interthreads/detail/wait_decorator_function.hpp
==============================================================================
--- (empty file)
+++ sandbox/interthreads/boost/interthreads/detail/wait_decorator_function.hpp 2009-02-08 16:01:47 EST (Sun, 08 Feb 2009)
@@ -0,0 +1,71 @@
+#ifndef BOOST_INTERTHREADS_WAIT_DECORATION_FUNCTION__HPP
+#define BOOST_INTERTHREADS_WAIT_DECORATION_FUNCTION__HPP
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2008-2009.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/interthreads for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#include <boost/interthreads/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>
+
+#include <boost/interthreads/detail/decorator_function.hpp>
+//#define BOOST_INTERTHREADS_THREAD_DECORATOR_MOVE
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost {
+namespace interthreads {
+ namespace detail {
+
+ template<typename F>
+ struct BOOST_INTERTHREADS_DECL wait_decorator_function : decorator_function_base<typename boost::result_of<F()>::type> {
+ F f_;
+ boost::condition_variable& cond_;
+ bool started_&;
+
+ typedef typename boost::result_of<F()>::type result_type;
+
+ wait_decorator_function(boost::condition_variable& cond, bool& started, F f)
+ : f_(f)
+ , cond_(cond)
+ , started_(started)
+ {}
+
+ typename boost::result_of<F()>::type operator()() const {
+ started_=true;
+ cond_.notify_one();
+ return f_();
+ }
+ private:
+ wait_decorator_function();
+
+ };
+
+ template<typename F>
+ static inline boost::shared_ptr<wait_decorator_function_base<typename boost::result_of<F()>::type> > make_wait_decorator_function(F f)
+ {
+ return boost::shared_ptr<wait_decorator_function_base<typename boost::result_of<F()>::type> >(new wait_decorator_function<F>(f));
+ }
+
+ }
+
+}
+}
+
+#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