|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r86770 - in branches/release: boost/thread boost/thread/csbl boost/thread/csbl/memory boost/thread/detail boost/thread/v2 libs/thread libs/thread/doc libs/thread/example libs/thread/src libs/thread/src/pthread libs/thread/src/win32 libs/thread/test libs/thread/test/sync/futures/async libs/thread/test/sync/futures/packaged_task libs/thread/test/sync/futures/promise libs/thread/test/sync/mutual_exclusion/sync_bounded_queue libs/thread/test/sync/mutual_exclusion/sync_queue libs/thread/test/sync/mutual_exclusion/synchronized_value libs/thread/test/threads/container
From: vicente.botet_at_[hidden]
Date: 2013-11-19 16:58:35
Author: viboes
Date: 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013)
New Revision: 86770
URL: http://svn.boost.org/trac/boost/changeset/86770
Log:
Thread: merge from trunk for 1.56.
Added:
branches/release/boost/thread/caller_context.hpp
- copied unchanged from r86594, trunk/boost/thread/caller_context.hpp
branches/release/boost/thread/csbl/
- copied from r86456, trunk/boost/thread/csbl/
branches/release/boost/thread/csbl/deque.hpp
- copied unchanged from r86539, trunk/boost/thread/csbl/deque.hpp
branches/release/boost/thread/csbl/list.hpp
- copied unchanged from r86539, trunk/boost/thread/csbl/list.hpp
branches/release/boost/thread/csbl/memory/
- copied from r86539, trunk/boost/thread/csbl/memory/
branches/release/boost/thread/csbl/memory.hpp
- copied unchanged from r86539, trunk/boost/thread/csbl/memory.hpp
branches/release/boost/thread/detail/function_wrapper.hpp
- copied, changed from r85961, trunk/boost/thread/detail/function_wrapper.hpp
branches/release/boost/thread/detail/nullary_function.hpp
- copied unchanged from r86445, trunk/boost/thread/detail/nullary_function.hpp
branches/release/boost/thread/detail/variadic_footer.hpp
- copied unchanged from r86658, trunk/boost/thread/detail/variadic_footer.hpp
branches/release/boost/thread/detail/variadic_header.hpp
- copied, changed from r86658, trunk/boost/thread/detail/variadic_header.hpp
branches/release/boost/thread/detail/work.hpp
- copied, changed from r86445, trunk/boost/thread/detail/work.hpp
branches/release/boost/thread/executor.hpp
- copied, changed from r86161, trunk/boost/thread/executor.hpp
branches/release/boost/thread/ostream_buffer.hpp
- copied, changed from r85733, trunk/boost/thread/ostream_buffer.hpp
branches/release/boost/thread/thread_pool.hpp
- copied, changed from r85961, trunk/boost/thread/thread_pool.hpp
branches/release/boost/thread/user_scheduler.hpp
- copied, changed from r86594, trunk/boost/thread/user_scheduler.hpp
branches/release/libs/thread/example/executor.cpp
- copied, changed from r86161, trunk/libs/thread/example/executor.cpp
branches/release/libs/thread/example/future_when_all.cpp
- copied, changed from r86356, trunk/libs/thread/example/future_when_all.cpp
branches/release/libs/thread/example/not_interleaved2.cpp
- copied unchanged from r85759, trunk/libs/thread/example/not_interleaved2.cpp
branches/release/libs/thread/example/thread_pool.cpp
- copied, changed from r85961, trunk/libs/thread/example/thread_pool.cpp
branches/release/libs/thread/example/user_scheduler.cpp
- copied unchanged from r86594, trunk/libs/thread/example/user_scheduler.cpp
branches/release/libs/thread/test/test_8455.cpp
- copied unchanged from r86546, trunk/libs/thread/test/test_8455.cpp
branches/release/libs/thread/test/test_8557.cpp
- copied unchanged from r86546, trunk/libs/thread/test/test_8557.cpp
branches/release/libs/thread/test/test_8586.cpp
- copied unchanged from r85759, trunk/libs/thread/test/test_8586.cpp
branches/release/libs/thread/test/test_8600.cpp
- copied unchanged from r85759, trunk/libs/thread/test/test_8600.cpp
branches/release/libs/thread/test/test_8943.cpp
- copied unchanged from r85759, trunk/libs/thread/test/test_8943.cpp
branches/release/libs/thread/test/test_8960.cpp
- copied unchanged from r85759, trunk/libs/thread/test/test_8960.cpp
branches/release/libs/thread/test/test_9192.cpp
- copied unchanged from r86546, trunk/libs/thread/test/test_9192.cpp
branches/release/libs/thread/test/test_9303.cpp
- copied unchanged from r86594, trunk/libs/thread/test/test_9303.cpp
branches/release/libs/thread/test/test_9319.cpp
- copied, changed from r86546, trunk/libs/thread/test/test_9319.cpp
branches/release/libs/thread/test/test_physical_concurrency.cpp
- copied unchanged from r85961, trunk/libs/thread/test/test_physical_concurrency.cpp
Replaced:
branches/release/boost/thread/csbl/functional.hpp
- copied, changed from r86456, trunk/boost/thread/csbl/functional.hpp
branches/release/boost/thread/csbl/memory/allocator_arg.hpp
- copied unchanged from r86539, trunk/boost/thread/csbl/memory/allocator_arg.hpp
branches/release/boost/thread/csbl/memory/allocator_traits.hpp
- copied unchanged from r86539, trunk/boost/thread/csbl/memory/allocator_traits.hpp
branches/release/boost/thread/csbl/memory/config.hpp
- copied unchanged from r86539, trunk/boost/thread/csbl/memory/config.hpp
branches/release/boost/thread/csbl/memory/default_delete.hpp
- copied unchanged from r86539, trunk/boost/thread/csbl/memory/default_delete.hpp
branches/release/boost/thread/csbl/memory/pointer_traits.hpp
- copied unchanged from r86539, trunk/boost/thread/csbl/memory/pointer_traits.hpp
branches/release/boost/thread/csbl/memory/scoped_allocator.hpp
- copied unchanged from r86539, trunk/boost/thread/csbl/memory/scoped_allocator.hpp
branches/release/boost/thread/csbl/memory/unique_ptr.hpp
- copied unchanged from r86539, trunk/boost/thread/csbl/memory/unique_ptr.hpp
branches/release/boost/thread/csbl/tuple.hpp
- copied, changed from r86456, trunk/boost/thread/csbl/tuple.hpp
branches/release/boost/thread/csbl/vector.hpp
- copied, changed from r86456, trunk/boost/thread/csbl/vector.hpp
Properties modified:
branches/release/boost/thread/ (props changed)
branches/release/boost/thread/v2/shared_mutex.hpp (props changed)
branches/release/libs/thread/ (props changed)
branches/release/libs/thread/src/future.cpp (contents, props changed)
Text files modified:
branches/release/boost/thread/barrier.hpp | 120 ++++--
branches/release/boost/thread/caller_context.hpp | 55 +++
branches/release/boost/thread/completion_latch.hpp | 15
branches/release/boost/thread/csbl/deque.hpp | 34 ++
branches/release/boost/thread/csbl/functional.hpp | 24 +
branches/release/boost/thread/csbl/list.hpp | 32 ++
branches/release/boost/thread/csbl/memory.hpp | 61 +++
branches/release/boost/thread/csbl/memory/allocator_arg.hpp | 41 ++
branches/release/boost/thread/csbl/memory/allocator_traits.hpp | 35 ++
branches/release/boost/thread/csbl/memory/config.hpp | 16 +
branches/release/boost/thread/csbl/memory/default_delete.hpp | 125 +++++++
branches/release/boost/thread/csbl/memory/pointer_traits.hpp | 35 ++
branches/release/boost/thread/csbl/memory/scoped_allocator.hpp | 35 ++
branches/release/boost/thread/csbl/memory/unique_ptr.hpp | 106 ++++++
branches/release/boost/thread/csbl/tuple.hpp | 13
branches/release/boost/thread/csbl/vector.hpp | 6
branches/release/boost/thread/detail/async_func.hpp | 280 ++++++++++++-----
branches/release/boost/thread/detail/config.hpp | 3
branches/release/boost/thread/detail/delete.hpp | 1
branches/release/boost/thread/detail/function_wrapper.hpp | 7
branches/release/boost/thread/detail/memory.hpp | 123 -------
branches/release/boost/thread/detail/move.hpp | 56 +++
branches/release/boost/thread/detail/nullary_function.hpp | 213 +++++++++++++
branches/release/boost/thread/detail/thread.hpp | 9
branches/release/boost/thread/detail/thread_group.hpp | 4
branches/release/boost/thread/detail/variadic_footer.hpp | 10
branches/release/boost/thread/detail/variadic_header.hpp | 3
branches/release/boost/thread/detail/work.hpp | 9
branches/release/boost/thread/exceptions.hpp | 8
branches/release/boost/thread/executor.hpp | 87 ++++
branches/release/boost/thread/externally_locked.hpp | 2
branches/release/boost/thread/future.hpp | 637 ++++++++++++++++++++++++++++++++++++++-
branches/release/boost/thread/future_error_code.hpp | 6
branches/release/boost/thread/lock_types.hpp | 80 ++--
branches/release/boost/thread/ostream_buffer.hpp | 16
branches/release/boost/thread/scoped_thread.hpp | 12
branches/release/boost/thread/sync_bounded_queue.hpp | 248 ++++++++++++++-
branches/release/boost/thread/sync_queue.hpp | 260 +++++++++++++++-
branches/release/boost/thread/synchronized_value.hpp | 4
branches/release/boost/thread/thread_pool.hpp | 102 +++--
branches/release/boost/thread/user_scheduler.hpp | 12
branches/release/libs/thread/doc/scoped_thread.qbk | 15
branches/release/libs/thread/doc/thread.qbk | 2
branches/release/libs/thread/doc/thread_ref.qbk | 16 +
branches/release/libs/thread/example/executor.cpp | 159 +++------
branches/release/libs/thread/example/future_fallback_to.cpp | 20 +
branches/release/libs/thread/example/future_unwrap.cpp | 5
branches/release/libs/thread/example/future_when_all.cpp | 19
branches/release/libs/thread/example/lambda_future.cpp | 2
branches/release/libs/thread/example/not_interleaved2.cpp | 61 +++
branches/release/libs/thread/example/producer_consumer.cpp | 43 +
branches/release/libs/thread/example/producer_consumer_bounded.cpp | 44 +
branches/release/libs/thread/example/thread_pool.cpp | 105 -----
branches/release/libs/thread/example/user_scheduler.cpp | 70 ++++
branches/release/libs/thread/src/future.cpp | 1
branches/release/libs/thread/src/pthread/thread.cpp | 69 ++++
branches/release/libs/thread/src/win32/thread.cpp | 25 +
branches/release/libs/thread/test/Jamfile.v2 | 50 ++
branches/release/libs/thread/test/sync/futures/async/async_pass.cpp | 120 ++++++-
branches/release/libs/thread/test/sync/futures/packaged_task/use_allocator_pass.cpp | 2
branches/release/libs/thread/test/sync/futures/promise/set_rvalue_at_thread_exit_pass.cpp | 13
branches/release/libs/thread/test/sync/futures/promise/use_allocator_pass.cpp | 6
branches/release/libs/thread/test/sync/mutual_exclusion/sync_bounded_queue/single_thread_pass.cpp | 63 +++
branches/release/libs/thread/test/sync/mutual_exclusion/sync_queue/multi_thread_pass.cpp | 28
branches/release/libs/thread/test/sync/mutual_exclusion/sync_queue/single_thread_pass.cpp | 163 +++++++++
branches/release/libs/thread/test/sync/mutual_exclusion/synchronized_value/call_pass.cpp | 2
branches/release/libs/thread/test/test_7720.cpp | 10
branches/release/libs/thread/test/test_8455.cpp | 23 +
branches/release/libs/thread/test/test_8557.cpp | 140 ++++++++
branches/release/libs/thread/test/test_8586.cpp | 18 +
branches/release/libs/thread/test/test_8596.cpp | 2
branches/release/libs/thread/test/test_8600.cpp | 140 ++++++++
branches/release/libs/thread/test/test_8943.cpp | 47 ++
branches/release/libs/thread/test/test_8960.cpp | 53 +++
branches/release/libs/thread/test/test_9079_b.cpp | 7
branches/release/libs/thread/test/test_9192.cpp | 140 ++++++++
branches/release/libs/thread/test/test_9303.cpp | 171 ++++++++++
branches/release/libs/thread/test/test_9319.cpp | 14
branches/release/libs/thread/test/test_physical_concurrency.cpp | 24 +
branches/release/libs/thread/test/threads/container/thread_ptr_list_pass.cpp | 6
branches/release/libs/thread/test/threads/container/thread_vector_pass.cpp | 5
81 files changed, 4066 insertions(+), 782 deletions(-)
Modified: branches/release/boost/thread/barrier.hpp
==============================================================================
--- branches/release/boost/thread/barrier.hpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/boost/thread/barrier.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -1,6 +1,7 @@
// Copyright (C) 2002-2003
// David Moore, William E. Kempf
// Copyright (C) 2007-8 Anthony Williams
+// (C) Copyright 2013 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)
@@ -17,11 +18,7 @@
#include <boost/thread/condition_variable.hpp>
#include <string>
#include <stdexcept>
-#ifdef BOOST_NO_CXX11_HDR_FUNCTIONAL
-#include <boost/function.hpp>
-#else
-#include <functional>
-#endif
+#include <boost/thread/detail/nullary_function.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/is_void.hpp>
#include <boost/utility/enable_if.hpp>
@@ -33,13 +30,8 @@
{
namespace thread_detail
{
-#ifdef BOOST_NO_CXX11_HDR_FUNCTIONAL
- typedef function<void()> void_completion_function;
- typedef function<size_t()> size_completion_function;
-#else
- typedef std::function<void()> void_completion_function;
- typedef std::function<size_t()> size_completion_function;
-#endif
+ typedef detail::nullary_function<void()> void_completion_function;
+ typedef detail::nullary_function<size_t()> size_completion_function;
struct default_barrier_reseter
{
@@ -48,6 +40,17 @@
size_(size)
{
}
+ BOOST_THREAD_MOVABLE(default_barrier_reseter)
+
+ default_barrier_reseter(default_barrier_reseter const& other) BOOST_NOEXCEPT :
+ size_(other.size_)
+ {
+ }
+ default_barrier_reseter(BOOST_THREAD_RV_REF(default_barrier_reseter) other) BOOST_NOEXCEPT :
+ size_(BOOST_THREAD_RV(other).size_)
+ {
+ }
+
unsigned int operator()()
{
return size_;
@@ -59,15 +62,25 @@
unsigned int size_;
void_completion_function fct_;
template <typename F>
-#ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL
void_functor_barrier_reseter(unsigned int size, BOOST_THREAD_RV_REF(F) funct)
: size_(size), fct_(boost::move(funct))
{}
-#else
- void_functor_barrier_reseter(unsigned int size, F funct)
+ template <typename F>
+ void_functor_barrier_reseter(unsigned int size, F& funct)
: size_(size), fct_(funct)
{}
-#endif
+
+ BOOST_THREAD_MOVABLE(void_functor_barrier_reseter)
+
+ void_functor_barrier_reseter(void_functor_barrier_reseter const& other) BOOST_NOEXCEPT :
+ size_(other.size_), fct_(other.fct_)
+ {
+ }
+ void_functor_barrier_reseter(BOOST_THREAD_RV_REF(void_functor_barrier_reseter) other) BOOST_NOEXCEPT :
+ size_(BOOST_THREAD_RV(other).size_), fct_(BOOST_THREAD_RV(other).fct_)
+ {
+ }
+
unsigned int operator()()
{
fct_();
@@ -82,6 +95,16 @@
size_(size), fct_(funct)
{
}
+ BOOST_THREAD_MOVABLE(void_fct_ptr_barrier_reseter)
+
+ void_fct_ptr_barrier_reseter(void_fct_ptr_barrier_reseter const& other) BOOST_NOEXCEPT :
+ size_(other.size_), fct_(other.fct_)
+ {
+ }
+ void_fct_ptr_barrier_reseter(BOOST_THREAD_RV_REF(void_fct_ptr_barrier_reseter) other) BOOST_NOEXCEPT :
+ size_(BOOST_THREAD_RV(other).size_), fct_(BOOST_THREAD_RV(other).fct_)
+ {
+ }
unsigned int operator()()
{
fct_();
@@ -105,31 +128,37 @@
BOOST_THREAD_NO_COPYABLE( barrier)
explicit barrier(unsigned int count) :
- m_count(check_counter(count)), m_generation(0), fct_(thread_detail::default_barrier_reseter(count))
+ m_count(check_counter(count)), m_generation(0), fct_(BOOST_THREAD_MAKE_RV_REF(thread_detail::default_barrier_reseter(count)))
{
}
template <typename F>
barrier(
unsigned int count,
-#ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL
BOOST_THREAD_RV_REF(F) funct,
-#else
- F funct,
-#endif
typename enable_if<
typename is_void<typename result_of<F>::type>::type, dummy*
>::type=0
)
: m_count(check_counter(count)),
- m_generation(0),
- fct_(thread_detail::void_functor_barrier_reseter(count,
-#ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL
- boost::move(funct)
-#else
- funct
-#endif
- )
+ m_generation(0),
+ fct_(BOOST_THREAD_MAKE_RV_REF(thread_detail::void_functor_barrier_reseter(count,
+ boost::move(funct)))
+ )
+ {
+ }
+ template <typename F>
+ barrier(
+ unsigned int count,
+ F &funct,
+ typename enable_if<
+ typename is_void<typename result_of<F>::type>::type, dummy*
+ >::type=0
+ )
+ : m_count(check_counter(count)),
+ m_generation(0),
+ fct_(BOOST_THREAD_MAKE_RV_REF(thread_detail::void_functor_barrier_reseter(count,
+ funct))
)
{
}
@@ -137,40 +166,43 @@
template <typename F>
barrier(
unsigned int count,
-#ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL
BOOST_THREAD_RV_REF(F) funct,
-#else
- F funct,
-#endif
typename enable_if<
typename is_same<typename result_of<F>::type, unsigned int>::type, dummy*
>::type=0
)
: m_count(check_counter(count)),
- m_generation(0),
- fct_(
-#ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL
- boost::move(funct)
-#else
- funct
-#endif
+ m_generation(0),
+ fct_(boost::move(funct))
+ {
+ }
+ template <typename F>
+ barrier(
+ unsigned int count,
+ F& funct,
+ typename enable_if<
+ typename is_same<typename result_of<F>::type, unsigned int>::type, dummy*
+ >::type=0
)
+ : m_count(check_counter(count)),
+ m_generation(0),
+ fct_(funct)
{
}
barrier(unsigned int count, void(*funct)()) :
m_count(check_counter(count)), m_generation(0),
fct_(funct
- ? thread_detail::size_completion_function(thread_detail::void_fct_ptr_barrier_reseter(count, funct))
- : thread_detail::size_completion_function(thread_detail::default_barrier_reseter(count))
+ ? BOOST_THREAD_MAKE_RV_REF(thread_detail::size_completion_function(BOOST_THREAD_MAKE_RV_REF(thread_detail::void_fct_ptr_barrier_reseter(count, funct))))
+ : BOOST_THREAD_MAKE_RV_REF(thread_detail::size_completion_function(BOOST_THREAD_MAKE_RV_REF(thread_detail::default_barrier_reseter(count))))
)
{
}
barrier(unsigned int count, unsigned int(*funct)()) :
m_count(check_counter(count)), m_generation(0),
fct_(funct
- ? thread_detail::size_completion_function(funct)
- : thread_detail::size_completion_function(thread_detail::default_barrier_reseter(count))
+ ? BOOST_THREAD_MAKE_RV_REF(thread_detail::size_completion_function(funct))
+ : BOOST_THREAD_MAKE_RV_REF(thread_detail::size_completion_function(BOOST_THREAD_MAKE_RV_REF(thread_detail::default_barrier_reseter(count))))
)
{
}
Copied: branches/release/boost/thread/caller_context.hpp (from r86594, trunk/boost/thread/caller_context.hpp)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/boost/thread/caller_context.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770, copy of r86594, trunk/boost/thread/caller_context.hpp)
@@ -0,0 +1,55 @@
+// (C) Copyright 2013 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)
+
+
+#ifndef BOOST_THREAD_CALL_CONTEXT_HPP
+#define BOOST_THREAD_CALL_CONTEXT_HPP
+
+#include <boost/thread/detail/config.hpp>
+#if defined BOOST_THREAD_USES_LOG_THREAD_ID
+#include <boost/thread/thread.hpp>
+#endif
+#include <boost/current_function.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost
+{
+
+ struct caller_context_t
+ {
+ const char * filename;
+ unsigned lineno;
+ const char * func;
+ caller_context_t(const char * filename, unsigned lineno, const char * func) :
+ filename(filename), lineno(lineno), func(func)
+ {
+ }
+ };
+
+#define BOOST_CONTEXTOF boost::caller_context_t(__FILE__, __LINE__, BOOST_CURRENT_FUNCTION)
+
+ template <typename OStream>
+ OStream& operator<<(OStream& os, caller_context_t const& ctx)
+ {
+#if defined BOOST_THREAD_USES_LOG_THREAD_ID
+ {
+ io::ios_flags_saver ifs( os );
+ os << std::left << std::setw(14) << boost::this_thread::get_id() << " ";
+ }
+#endif
+ {
+ io::ios_flags_saver ifs(os);
+ os << ctx.filename << "["
+ << std::setw(4) << std::right << std::dec<< ctx.lineno << "] ";
+ os << ctx.func << " " ;
+ }
+ return os;
+ }
+}
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif // header
Modified: branches/release/boost/thread/completion_latch.hpp
==============================================================================
--- branches/release/boost/thread/completion_latch.hpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/boost/thread/completion_latch.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -16,12 +16,8 @@
#include <boost/chrono/duration.hpp>
#include <boost/chrono/time_point.hpp>
#include <boost/assert.hpp>
-#ifdef BOOST_NO_CXX11_HDR_FUNCTIONAL
-#include <boost/function.hpp>
-#else
-#include <functional>
-#endif
-//#include <boost/thread/latch.hpp>
+//#include <boost/thread/detail/nullary_function.hpp>
+#include <boost/thread/csbl/functional.hpp>
#include <boost/config/abi_prefix.hpp>
@@ -37,11 +33,8 @@
{
public:
/// the implementation defined completion function type
-#ifdef BOOST_NO_CXX11_HDR_FUNCTIONAL
- typedef function<void()> completion_function;
-#else
- typedef std::function<void()> completion_function;
-#endif
+ //typedef detail::nullary_function<void()> completion_function;
+ typedef csbl::function<void()> completion_function;
/// noop completion function factory
static completion_function noop()
{
Copied: branches/release/boost/thread/csbl/deque.hpp (from r86539, trunk/boost/thread/csbl/deque.hpp)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/boost/thread/csbl/deque.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770, copy of r86539, trunk/boost/thread/csbl/deque.hpp)
@@ -0,0 +1,34 @@
+// Copyright (C) 2013 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)
+//
+// 2013/10 Vicente J. Botet Escriba
+// Creation.
+
+#ifndef BOOST_CSBL_DEQUE_HPP
+#define BOOST_CSBL_DEQUE_HPP
+
+#include <boost/config.hpp>
+
+#if defined BOOST_NO_CXX11_HDR_DEQUE || defined BOOST_NO_CXX11_RVALUE_REFERENCES
+#include <boost/container/deque.hpp>
+#else
+#include <deque>
+#endif
+
+namespace boost
+{
+ namespace csbl
+ {
+#if defined BOOST_NO_CXX11_HDR_DEQUE || defined BOOST_NO_CXX11_RVALUE_REFERENCES
+ using ::boost::container::deque;
+
+#else
+ using ::std::deque;
+
+#endif
+
+ }
+}
+#endif // header
Copied and modified: branches/release/boost/thread/csbl/functional.hpp (from r86456, trunk/boost/thread/csbl/functional.hpp)
==============================================================================
--- trunk/boost/thread/csbl/functional.hpp Sat Oct 26 11:30:09 2013 (r86456, copy source)
+++ branches/release/boost/thread/csbl/functional.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -11,22 +11,34 @@
#include <boost/config.hpp>
-#ifdef BOOST_NO_CXX11_HDR_FUNCTIONAL
-#include <boost/function.hpp>
-#else
#include <functional>
+
+#if defined BOOST_NO_CXX11_HDR_FUNCTIONAL || defined BOOST_NO_CXX11_RVALUE_REFERENCES
+#include <boost/function.hpp>
#endif
namespace boost
{
namespace csbl
{
-#ifdef BOOST_NO_CXX11_HDR_FUNCTIONAL
+#if defined BOOST_NO_CXX11_HDR_FUNCTIONAL || defined BOOST_NO_CXX11_RVALUE_REFERENCES
using ::boost::function;
-
#else
+ // D.8.1, base (deprecated):
+ // 20.9.3, reference_wrapper:
+ // 20.9.4, arithmetic operations:
+ // 20.9.5, comparisons:
+ // 20.9.6, logical operations:
+ // 20.9.7, bitwise operations:
+ // 20.9.8, negators:
+ // 20.9.9, bind:
+ // D.9, binders (deprecated):
+ // D.8.2.1, adaptors (deprecated):
+ // D.8.2.2, adaptors (deprecated):
+ // 20.9.10, member function adaptors:
+ // 20.9.11 polymorphic function wrappers:
using ::std::function;
-
+ // 20.9.12, hash function primary template:
#endif
}
Copied: branches/release/boost/thread/csbl/list.hpp (from r86539, trunk/boost/thread/csbl/list.hpp)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/boost/thread/csbl/list.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770, copy of r86539, trunk/boost/thread/csbl/list.hpp)
@@ -0,0 +1,32 @@
+// Copyright (C) 2013 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)
+//
+// 2013/10 Vicente J. Botet Escriba
+// Creation.
+
+#ifndef BOOST_CSBL_LIST_HPP
+#define BOOST_CSBL_LIST_HPP
+
+#include <boost/config.hpp>
+
+#if defined BOOST_NO_CXX11_HDR_LIST || defined BOOST_NO_CXX11_RVALUE_REFERENCES
+#include <boost/container/list.hpp>
+#else
+#include <list>
+#endif
+
+namespace boost
+{
+ namespace csbl
+ {
+#if defined BOOST_NO_CXX11_HDR_LIST || defined BOOST_NO_CXX11_RVALUE_REFERENCES
+ using ::boost::container::list;
+#else
+ using ::std::list;
+#endif
+
+ }
+}
+#endif // header
Copied: branches/release/boost/thread/csbl/memory.hpp (from r86539, trunk/boost/thread/csbl/memory.hpp)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/boost/thread/csbl/memory.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770, copy of r86539, trunk/boost/thread/csbl/memory.hpp)
@@ -0,0 +1,61 @@
+// Copyright (C) 2013 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)
+//
+// 2013/10 Vicente J. Botet Escriba
+// Creation.
+
+#ifndef BOOST_CSBL_MEMORY_HPP
+#define BOOST_CSBL_MEMORY_HPP
+
+// 20.7.2 Header <memory> synopsis
+
+// 20.7.3, pointer traits
+#include <boost/thread/csbl/memory/pointer_traits.hpp>
+
+// 20.7.4, pointer safety
+// 20.7.5, pointer alignment function
+
+// 20.7.6, allocator argument tag
+#include <boost/thread/csbl/memory/allocator_arg.hpp>
+
+// 20.7.8, allocator traits
+#include <boost/thread/csbl/memory/allocator_traits.hpp>
+
+// 20.7.7, uses_allocator
+#include <boost/thread/csbl/memory/scoped_allocator.hpp>
+
+// 20.7.9, the default allocator:
+namespace boost
+{
+ namespace csbl
+ {
+ using ::std::allocator;
+ }
+}
+// 20.7.10, raw storage iterator:
+// 20.7.11, temporary buffers:
+// 20.7.12, specialized algorithms:
+
+// 20.8.1 class template unique_ptr:
+// default_delete
+#include <boost/thread/csbl/memory/default_delete.hpp>
+#include <boost/thread/csbl/memory/unique_ptr.hpp>
+
+// 20.8.2.1, class bad_weak_ptr:
+// 20.8.2.2, class template shared_ptr:
+// 20.8.2.2.6, shared_ptr creation
+// 20.8.2.2.7, shared_ptr comparisons:
+// 20.8.2.2.8, shared_ptr specialized algorithms:
+// 20.8.2.2.9, shared_ptr casts:
+// 20.8.2.2.10, shared_ptr get_deleter:
+// 20.8.2.2.11, shared_ptr I/O:
+// 20.8.2.3, class template weak_ptr:
+// 20.8.2.3.6, weak_ptr specialized algorithms:
+// 20.8.2.3.7, class template owner_less:
+// 20.8.2.4, class template enable_shared_from_this:
+// 20.8.2.5, shared_ptr atomic access:
+// 20.8.2.6 hash support
+
+#endif // header
Copied: branches/release/boost/thread/csbl/memory/allocator_arg.hpp (from r86539, trunk/boost/thread/csbl/memory/allocator_arg.hpp)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/boost/thread/csbl/memory/allocator_arg.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770, copy of r86539, trunk/boost/thread/csbl/memory/allocator_arg.hpp)
@@ -0,0 +1,41 @@
+// Copyright (C) 2013 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)
+//
+// 2013/10 Vicente J. Botet Escriba
+// Creation.
+
+#ifndef BOOST_CSBL_MEMORY_ALLOCATOR_ARG_HPP
+#define BOOST_CSBL_MEMORY_ALLOCATOR_ARG_HPP
+
+#include <boost/thread/csbl/memory/config.hpp>
+
+// 20.7.6, allocator argument tag
+#if defined BOOST_NO_CXX11_ALLOCATOR
+#include <boost/container/scoped_allocator.hpp>
+
+namespace boost
+{
+ namespace csbl
+ {
+ using ::boost::container::allocator_arg_t;
+ using ::boost::container::allocator_arg;
+ }
+}
+#else
+namespace boost
+{
+ namespace csbl
+ {
+ using ::std::allocator_arg_t;
+ using ::std::allocator_arg;
+ }
+}
+#endif // BOOST_NO_CXX11_ALLOCATOR
+namespace boost
+{
+ using ::boost::csbl::allocator_arg_t;
+ using ::boost::csbl::allocator_arg;
+}
+#endif // header
Copied: branches/release/boost/thread/csbl/memory/allocator_traits.hpp (from r86539, trunk/boost/thread/csbl/memory/allocator_traits.hpp)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/boost/thread/csbl/memory/allocator_traits.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770, copy of r86539, trunk/boost/thread/csbl/memory/allocator_traits.hpp)
@@ -0,0 +1,35 @@
+// Copyright (C) 2013 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)
+//
+// 2013/10 Vicente J. Botet Escriba
+// Creation.
+
+#ifndef BOOST_CSBL_MEMORY_ALLOCATOR_TRAITS_HPP
+#define BOOST_CSBL_MEMORY_ALLOCATOR_TRAITS_HPP
+
+#include <boost/thread/csbl/memory/config.hpp>
+
+// 20.7.8, allocator traits
+#if defined BOOST_NO_CXX11_ALLOCATOR
+#include <boost/container/allocator_traits.hpp>
+
+namespace boost
+{
+ namespace csbl
+ {
+ using ::boost::container::allocator_traits;
+ }
+}
+#else
+namespace boost
+{
+ namespace csbl
+ {
+ using ::std::allocator_traits;
+ }
+}
+#endif // BOOST_NO_CXX11_POINTER_TRAITS
+
+#endif // header
Copied: branches/release/boost/thread/csbl/memory/config.hpp (from r86539, trunk/boost/thread/csbl/memory/config.hpp)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/boost/thread/csbl/memory/config.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770, copy of r86539, trunk/boost/thread/csbl/memory/config.hpp)
@@ -0,0 +1,16 @@
+// Copyright (C) 2013 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)
+//
+// 2013/10 Vicente J. Botet Escriba
+// Creation.
+
+#ifndef BOOST_CSBL_MEMORY_CONFIG_HPP
+#define BOOST_CSBL_MEMORY_CONFIG_HPP
+
+#include <boost/config.hpp>
+
+#include <memory>
+
+#endif // header
Copied: branches/release/boost/thread/csbl/memory/default_delete.hpp (from r86539, trunk/boost/thread/csbl/memory/default_delete.hpp)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/boost/thread/csbl/memory/default_delete.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770, copy of r86539, trunk/boost/thread/csbl/memory/default_delete.hpp)
@@ -0,0 +1,125 @@
+// Copyright (C) 2013 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)
+//
+// 2013/10 Vicente J. Botet Escriba
+// Creation.
+
+#ifndef BOOST_CSBL_MEMORY_DEFAULT_DELETE_HPP
+#define BOOST_CSBL_MEMORY_DEFAULT_DELETE_HPP
+
+#include <boost/thread/csbl/memory/config.hpp>
+
+// 20.8.1 class template unique_ptr:
+// default_delete
+
+#if defined BOOST_NO_CXX11_SMART_PTR
+#include <boost/thread/csbl/memory/pointer_traits.hpp>
+#include <boost/type_traits/remove_cv.hpp>
+#include <boost/type_traits/is_convertible.hpp>
+#include <boost/type_traits/is_scalar.hpp>
+#include <boost/type_traits/is_pointer.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/static_assert.hpp>
+
+namespace boost
+{
+ namespace csbl
+ {
+ namespace detail
+ {
+
+ template <class _Ptr1, class _Ptr2,
+ bool = is_same<typename remove_cv<typename pointer_traits<_Ptr1>::element_type>::type,
+ typename remove_cv<typename pointer_traits<_Ptr2>::element_type>::type
+ >::value
+ >
+ struct same_or_less_cv_qualified_imp
+ : is_convertible<_Ptr1, _Ptr2>
+ {};
+
+ template <class _Ptr1, class _Ptr2>
+ struct same_or_less_cv_qualified_imp<_Ptr1, _Ptr2, false>
+ : false_type
+ {};
+
+ template <class _Ptr1, class _Ptr2, bool = is_scalar<_Ptr1>::value &&
+ !is_pointer<_Ptr1>::value>
+ struct same_or_less_cv_qualified
+ : same_or_less_cv_qualified_imp<_Ptr1, _Ptr2>
+ {};
+
+ template <class _Ptr1, class _Ptr2>
+ struct same_or_less_cv_qualified<_Ptr1, _Ptr2, true>
+ : false_type
+ {};
+
+ }
+ template <class T>
+ struct BOOST_SYMBOL_VISIBLE default_delete
+ {
+#ifndef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
+ BOOST_SYMBOL_VISIBLE
+ BOOST_CONSTEXPR default_delete() = default;
+#else
+ BOOST_SYMBOL_VISIBLE
+ BOOST_CONSTEXPR default_delete() BOOST_NOEXCEPT
+ {}
+#endif
+ template <class U>
+ BOOST_SYMBOL_VISIBLE
+ default_delete(const default_delete<U>&,
+ typename enable_if<is_convertible<U*, T*> >::type* = 0) BOOST_NOEXCEPT
+ {}
+ BOOST_SYMBOL_VISIBLE
+ void operator() (T* ptr) const BOOST_NOEXCEPT
+ {
+ BOOST_STATIC_ASSERT_MSG(sizeof(T) > 0, "default_delete can not delete incomplete type");
+ delete ptr;
+ }
+ };
+
+ template <class T>
+ struct BOOST_SYMBOL_VISIBLE default_delete<T[]>
+ {
+ public:
+#ifndef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
+ BOOST_SYMBOL_VISIBLE
+ BOOST_CONSTEXPR default_delete() = default;
+#else
+ BOOST_SYMBOL_VISIBLE
+ BOOST_CONSTEXPR default_delete() BOOST_NOEXCEPT
+ {}
+#endif
+ template <class U>
+ BOOST_SYMBOL_VISIBLE
+ default_delete(const default_delete<U[]>&,
+ typename enable_if<detail::same_or_less_cv_qualified<U*, T*> >::type* = 0) BOOST_NOEXCEPT
+ {}
+ template <class U>
+ BOOST_SYMBOL_VISIBLE
+ void operator() (U* ptr,
+ typename enable_if<detail::same_or_less_cv_qualified<U*, T*> >::type* = 0) const BOOST_NOEXCEPT
+ {
+ BOOST_STATIC_ASSERT_MSG(sizeof(T) > 0, "default_delete can not delete incomplete type");
+ delete [] ptr;
+ }
+ };
+ }
+}
+#else
+namespace boost
+{
+ namespace csbl
+ {
+ using ::std::default_delete;
+ }
+}
+#endif // defined BOOST_NO_CXX11_SMART_PTR
+
+namespace boost
+{
+ using ::boost::csbl::default_delete;
+}
+#endif // header
Copied: branches/release/boost/thread/csbl/memory/pointer_traits.hpp (from r86539, trunk/boost/thread/csbl/memory/pointer_traits.hpp)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/boost/thread/csbl/memory/pointer_traits.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770, copy of r86539, trunk/boost/thread/csbl/memory/pointer_traits.hpp)
@@ -0,0 +1,35 @@
+// Copyright (C) 2013 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)
+//
+// 2013/10 Vicente J. Botet Escriba
+// Creation.
+
+#ifndef BOOST_CSBL_MEMORY_POINTER_TRAITS_HPP
+#define BOOST_CSBL_MEMORY_POINTER_TRAITS_HPP
+
+#include <boost/thread/csbl/memory/config.hpp>
+
+// 20.7.3, pointer traits
+#if defined BOOST_NO_CXX11_ALLOCATOR
+#include <boost/intrusive/pointer_traits.hpp>
+
+namespace boost
+{
+ namespace csbl
+ {
+ using ::boost::intrusive::pointer_traits;
+ }
+}
+#else
+namespace boost
+{
+ namespace csbl
+ {
+ using ::std::pointer_traits;
+ }
+}
+#endif // BOOST_NO_CXX11_ALLOCATOR
+
+#endif // header
Copied: branches/release/boost/thread/csbl/memory/scoped_allocator.hpp (from r86539, trunk/boost/thread/csbl/memory/scoped_allocator.hpp)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/boost/thread/csbl/memory/scoped_allocator.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770, copy of r86539, trunk/boost/thread/csbl/memory/scoped_allocator.hpp)
@@ -0,0 +1,35 @@
+// Copyright (C) 2013 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)
+//
+// 2013/10 Vicente J. Botet Escriba
+// Creation.
+
+#ifndef BOOST_CSBL_MEMORY_SCOPED_ALLOCATOR_HPP
+#define BOOST_CSBL_MEMORY_SCOPED_ALLOCATOR_HPP
+
+#include <boost/thread/csbl/memory/config.hpp>
+
+// 20.7.7, uses_allocator
+#if defined BOOST_NO_CXX11_ALLOCATOR
+#include <boost/container/scoped_allocator.hpp>
+
+namespace boost
+{
+ namespace csbl
+ {
+ using ::boost::container::uses_allocator;
+ }
+}
+#else
+namespace boost
+{
+ namespace csbl
+ {
+ using ::std::uses_allocator;
+ }
+}
+#endif // BOOST_NO_CXX11_POINTER_TRAITS
+
+#endif // header
Copied: branches/release/boost/thread/csbl/memory/unique_ptr.hpp (from r86539, trunk/boost/thread/csbl/memory/unique_ptr.hpp)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/boost/thread/csbl/memory/unique_ptr.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770, copy of r86539, trunk/boost/thread/csbl/memory/unique_ptr.hpp)
@@ -0,0 +1,106 @@
+// Copyright (C) 2013 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)
+//
+// 2013/10 Vicente J. Botet Escriba
+// Creation.
+
+#ifndef BOOST_CSBL_MEMORY_UNIQUE_PTR_HPP
+#define BOOST_CSBL_MEMORY_UNIQUE_PTR_HPP
+
+#include <boost/thread/csbl/memory/config.hpp>
+
+// 20.8.1 class template unique_ptr:
+#if defined BOOST_NO_CXX11_SMART_PTR
+#include <boost/thread/csbl/memory/default_delete.hpp>
+
+#include <boost/interprocess/smart_ptr/unique_ptr.hpp>
+
+namespace boost
+{
+ namespace csbl
+ {
+ template <class T, class D = default_delete<T> > class unique_ptr :
+ public ::boost::interprocess::unique_ptr<T,D>
+ {
+ typedef ::boost::interprocess::unique_ptr<T,D> base_type;
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(unique_ptr)
+ protected:
+ //typedef typename base_type::nat nat;
+ //typedef typename base_type::nullptr_t nullptr_t;
+ struct nat {int for_bool;};
+ struct nat2 {int for_nullptr;};
+ typedef int nat2::*nullptr_t;
+
+ public:
+ typedef typename base_type::element_type element_type;
+ typedef typename base_type::deleter_type deleter_type;
+ typedef typename base_type::pointer pointer;
+
+ unique_ptr() : base_type()
+ {}
+ explicit unique_ptr(pointer p): base_type(p)
+ {}
+ unique_ptr(pointer p
+ ,typename interprocess::ipcdetail::if_<interprocess::ipcdetail::is_reference<D>
+ ,D
+ ,typename interprocess::ipcdetail::add_reference<const D>::type>::type d)
+ : base_type(p, d)
+ {}
+ unique_ptr(BOOST_RV_REF(unique_ptr) u)
+ : base_type(boost::move(static_cast<base_type&>(u)))
+ {}
+ template <class U, class E>
+ unique_ptr(BOOST_RV_REF_BEG unique_ptr<U, E> BOOST_RV_REF_END u,
+ typename interprocess::ipcdetail::enable_if_c<
+ interprocess::ipcdetail::is_convertible<typename unique_ptr<U, E>::pointer, pointer>::value &&
+ interprocess::ipcdetail::is_convertible<E, D>::value &&
+ (
+ !interprocess::ipcdetail::is_reference<D>::value ||
+ interprocess::ipcdetail::is_same<D, E>::value
+ )
+ ,
+ nat
+ >::type = nat())
+ : base_type(boost::move(static_cast< ::boost::interprocess::unique_ptr<U,E>&>(u)))
+ {}
+ unique_ptr& operator=(BOOST_RV_REF(unique_ptr) u)
+ {
+ this->base_type.operator=(boost::move(static_cast<base_type&>(u)));
+ return *this;
+ }
+ template <class U, class E>
+ unique_ptr& operator=(BOOST_RV_REF_BEG unique_ptr<U, E> BOOST_RV_REF_END u)
+ {
+ this->base_type.template operator=<U,E>(boost::move(static_cast< ::boost::interprocess::unique_ptr<U,E>&>(u)));
+ return *this;
+ }
+ unique_ptr& operator=(nullptr_t t)
+ {
+ this->base_type.operator=(t);
+ return *this;
+ }
+ void swap(unique_ptr& u)
+ {
+ this->base_type.swap(u);
+ }
+ };
+ template <class T, class D>
+ class unique_ptr<T[], D> :
+ public ::boost::interprocess::unique_ptr<T[],D>
+ {
+
+ };
+ }
+}
+#else
+namespace boost
+{
+ namespace csbl
+ {
+ using ::std::unique_ptr;
+ }
+}
+#endif // BOOST_NO_CXX11_SMART_PTR
+#endif // header
Copied and modified: branches/release/boost/thread/csbl/tuple.hpp (from r86456, trunk/boost/thread/csbl/tuple.hpp)
==============================================================================
--- trunk/boost/thread/csbl/tuple.hpp Sat Oct 26 11:30:09 2013 (r86456, copy source)
+++ branches/release/boost/thread/csbl/tuple.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -11,7 +11,7 @@
#include <boost/config.hpp>
-#ifdef BOOST_NO_CXX11_HDR_TUPLE
+#if defined BOOST_NO_CXX11_HDR_TUPLE || defined BOOST_NO_CXX11_RVALUE_REFERENCES
#include <boost/tuple/tuple.hpp>
#else
#include <tuple>
@@ -21,12 +21,17 @@
{
namespace csbl
{
-#ifdef BOOST_NO_CXX11_HDR_TUPLE
+#if defined BOOST_NO_CXX11_HDR_TUPLE || defined BOOST_NO_CXX11_RVALUE_REFERENCES
using ::boost::tuple;
-
#else
+ // 20.4.2, class template tuple:
using ::std::tuple;
-
+ // 20.4.2.4, tuple creation functions:
+ // 20.4.2.5, tuple helper classes:
+ // 20.4.2.6, element access:
+ // 20.4.2.7, relational operators:
+ // 20.4.2.8, allocator-related traits
+ // 20.4.2.9, specialized algorithms:
#endif
}
Copied and modified: branches/release/boost/thread/csbl/vector.hpp (from r86456, trunk/boost/thread/csbl/vector.hpp)
==============================================================================
--- trunk/boost/thread/csbl/vector.hpp Sat Oct 26 11:30:09 2013 (r86456, copy source)
+++ branches/release/boost/thread/csbl/vector.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -11,7 +11,7 @@
#include <boost/config.hpp>
-#ifdef BOOST_NO_CXX11_HDR_VECTOR
+#if defined BOOST_NO_CXX11_HDR_VECTOR || defined BOOST_NO_CXX11_RVALUE_REFERENCES
#include <boost/container/vector.hpp>
#else
#include <vector>
@@ -21,12 +21,10 @@
{
namespace csbl
{
-#ifdef BOOST_NO_CXX11_HDR_VECTOR
+#if defined BOOST_NO_CXX11_HDR_VECTOR || defined BOOST_NO_CXX11_RVALUE_REFERENCES
using ::boost::container::vector;
-
#else
using ::std::vector;
-
#endif
}
Modified: branches/release/boost/thread/detail/async_func.hpp
==============================================================================
--- branches/release/boost/thread/detail/async_func.hpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/boost/thread/detail/async_func.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -29,13 +29,11 @@
#include <boost/thread/detail/move.hpp>
#include <boost/thread/detail/invoke.hpp>
#include <boost/thread/detail/make_tuple_indices.hpp>
-
-#if ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \
- ! defined(BOOST_NO_CXX11_HDR_TUPLE)
-#include <tuple>
-#else
+#include <boost/thread/csbl/tuple.hpp>
#include <boost/tuple/tuple.hpp>
-#endif
+
+#include <boost/thread/detail/variadic_header.hpp>
+
namespace boost
{
@@ -48,7 +46,7 @@
template <class Fp, class ... Args>
class async_func
{
- std::tuple<Fp, Args...> f_;
+ csbl::tuple<Fp, Args...> f_;
public:
BOOST_THREAD_MOVABLE_ONLY( async_func)
@@ -61,7 +59,7 @@
{}
BOOST_SYMBOL_VISIBLE
- async_func(BOOST_THREAD_RV_REF(async_func) f) : f_(boost::move(f.f_))
+ async_func(BOOST_THREAD_RV_REF(async_func) f) : f_(boost::move(BOOST_THREAD_RV(f).f_))
{}
result_type operator()()
@@ -79,6 +77,103 @@
};
//BOOST_THREAD_DCL_MOVABLE_BEG(X) async_func<Fp> BOOST_THREAD_DCL_MOVABLE_END
#else
+
+#if ! defined BOOST_MSVC
+
+#define BOOST_THREAD_RV_REF_ARG_T(z, n, unused) BOOST_PP_COMMA_IF(n) BOOST_THREAD_RV_REF(Arg##n)
+#define BOOST_THREAD_RV_REF_ARG(z, n, unused) , BOOST_THREAD_RV_REF(Arg##n) arg##n
+#define BOOST_THREAD_FWD_REF_ARG(z, n, unused) , BOOST_THREAD_FWD_REF(Arg##n) arg##n
+#define BOOST_THREAD_FWD_PARAM(z, n, unused) , boost::forward<Arg##n>(arg##n)
+#define BOOST_THREAD_DCL(z, n, unused) Arg##n v##n;
+#define BOOST_THREAD_MOVE_PARAM(z, n, unused) , v##n(boost::move(arg##n))
+#define BOOST_THREAD_MOVE_RHS_PARAM(z, n, unused) , v##n(boost::move(x.v##n))
+#define BOOST_THREAD_MOVE_DCL(z, n, unused) , boost::move(v##n)
+#define BOOST_THREAD_MOVE_DCL_T(z, n, unused) BOOST_PP_COMMA_IF(n) boost::move(v##n)
+#define BOOST_THREAD_ARG_DEF(z, n, unused) , class Arg##n = tuples::null_type
+
+ template <class Fp, class Arg = tuples::null_type
+ BOOST_PP_REPEAT(BOOST_THREAD_MAX_ARGS, BOOST_THREAD_ARG_DEF, ~)
+ >
+ class async_func;
+
+#define BOOST_THREAD_ASYNC_FUNCT(z, n, unused) \
+ template <class Fp BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, class Arg) > \
+ class async_func<Fp BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, Arg)> \
+ { \
+ Fp fp_; \
+ BOOST_PP_REPEAT(n, BOOST_THREAD_DCL, ~) \
+ public: \
+ BOOST_THREAD_MOVABLE_ONLY(async_func) \
+ typedef typename result_of<Fp(BOOST_PP_ENUM_PARAMS(n, Arg))>::type result_type; \
+ \
+ BOOST_SYMBOL_VISIBLE \
+ explicit async_func(BOOST_THREAD_FWD_REF(Fp) f \
+ BOOST_PP_REPEAT(n, BOOST_THREAD_RV_REF_ARG, ~) \
+ ) \
+ : fp_(boost::move(f)) \
+ BOOST_PP_REPEAT(n, BOOST_THREAD_MOVE_PARAM, ~) \
+ {} \
+ \
+ BOOST_SYMBOL_VISIBLE \
+ async_func(BOOST_THREAD_FWD_REF(async_func) x) \
+ : fp_(boost::move(x.fp_)) \
+ BOOST_PP_REPEAT(n, BOOST_THREAD_MOVE_RHS_PARAM, ~) \
+ {} \
+ \
+ result_type operator()() { \
+ return invoke(boost::move(fp_) \
+ BOOST_PP_REPEAT(n, BOOST_THREAD_MOVE_DCL, ~) \
+ ); \
+ } \
+ }; \
+ \
+ template <class R BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, class Arg) > \
+ class async_func<R(*)(BOOST_PP_REPEAT(n, BOOST_THREAD_RV_REF_ARG_T, ~)) BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, Arg)> \
+ { \
+ typedef R(*Fp)(BOOST_PP_REPEAT(n, BOOST_THREAD_RV_REF_ARG_T, ~)); \
+ Fp fp_; \
+ BOOST_PP_REPEAT(n, BOOST_THREAD_DCL, ~) \
+ public: \
+ BOOST_THREAD_MOVABLE_ONLY(async_func) \
+ typedef typename result_of<Fp(BOOST_PP_ENUM_PARAMS(n, Arg))>::type result_type; \
+ \
+ BOOST_SYMBOL_VISIBLE \
+ explicit async_func(Fp f \
+ BOOST_PP_REPEAT(n, BOOST_THREAD_RV_REF_ARG, ~) \
+ ) \
+ : fp_(f) \
+ BOOST_PP_REPEAT(n, BOOST_THREAD_MOVE_PARAM, ~) \
+ {} \
+ \
+ BOOST_SYMBOL_VISIBLE \
+ async_func(BOOST_THREAD_FWD_REF(async_func) x) \
+ : fp_(x.fp_) \
+ BOOST_PP_REPEAT(n, BOOST_THREAD_MOVE_RHS_PARAM, ~) \
+ {} \
+ \
+ result_type operator()() { \
+ return fp_( \
+ BOOST_PP_REPEAT(n, BOOST_THREAD_MOVE_DCL_T, ~) \
+ ); \
+ } \
+ };
+
+
+ BOOST_PP_REPEAT(BOOST_THREAD_MAX_ARGS, BOOST_THREAD_ASYNC_FUNCT, ~)
+
+ #undef BOOST_THREAD_RV_REF_ARG_T
+ #undef BOOST_THREAD_RV_REF_ARG
+ #undef BOOST_THREAD_FWD_REF_ARG
+ #undef BOOST_THREAD_FWD_PARAM
+ #undef BOOST_THREAD_DCL
+ #undef BOOST_THREAD_MOVE_PARAM
+ #undef BOOST_THREAD_MOVE_RHS_PARAM
+ #undef BOOST_THREAD_MOVE_DCL
+ #undef BOOST_THREAD_ARG_DEF
+ #undef BOOST_THREAD_ASYNC_FUNCT
+
+#else
+
template <class Fp,
class T0 = tuples::null_type, class T1 = tuples::null_type, class T2 = tuples::null_type,
class T3 = tuples::null_type, class T4 = tuples::null_type, class T5 = tuples::null_type,
@@ -110,7 +205,7 @@
typedef typename result_of<Fp(T0, T1, T2, T3, T4, T5, T6, T7, T8)>::type result_type;
BOOST_SYMBOL_VISIBLE
- explicit async_func(BOOST_THREAD_RV_REF(Fp) f
+ explicit async_func(BOOST_THREAD_FWD_REF(Fp) f
, BOOST_THREAD_RV_REF(T0) a0
, BOOST_THREAD_RV_REF(T1) a1
, BOOST_THREAD_RV_REF(T2) a2
@@ -134,17 +229,17 @@
{}
BOOST_SYMBOL_VISIBLE
- async_func(BOOST_THREAD_RV_REF(async_func) f)
- : fp_(boost::move(f.fp))
- , v0_(boost::move(f.a0))
- , v1_(boost::move(f.a1))
- , v2_(boost::move(f.a2))
- , v3_(boost::move(f.a3))
- , v4_(boost::move(f.a4))
- , v5_(boost::move(f.a5))
- , v6_(boost::move(f.a6))
- , v7_(boost::move(f.a7))
- , v8_(boost::move(f.a8))
+ async_func(BOOST_THREAD_FWD_REF(async_func) f)
+ : fp_(boost::move(BOOST_THREAD_RV(f).fp))
+ , v0_(boost::move(BOOST_THREAD_RV(f).v0_))
+ , v1_(boost::move(BOOST_THREAD_RV(f).v1_))
+ , v2_(boost::move(BOOST_THREAD_RV(f).v2_))
+ , v3_(boost::move(BOOST_THREAD_RV(f).v3_))
+ , v4_(boost::move(BOOST_THREAD_RV(f).v4_))
+ , v5_(boost::move(BOOST_THREAD_RV(f).v5_))
+ , v6_(boost::move(BOOST_THREAD_RV(f).v6_))
+ , v7_(boost::move(BOOST_THREAD_RV(f).v7_))
+ , v8_(boost::move(BOOST_THREAD_RV(f).v8_))
{}
result_type operator()()
@@ -179,7 +274,7 @@
typedef typename result_of<Fp(T0, T1, T2, T3, T4, T5, T6, T7)>::type result_type;
BOOST_SYMBOL_VISIBLE
- explicit async_func(BOOST_THREAD_RV_REF(Fp) f
+ explicit async_func(BOOST_THREAD_FWD_REF(Fp) f
, BOOST_THREAD_RV_REF(T0) a0
, BOOST_THREAD_RV_REF(T1) a1
, BOOST_THREAD_RV_REF(T2) a2
@@ -201,16 +296,16 @@
{}
BOOST_SYMBOL_VISIBLE
- async_func(BOOST_THREAD_RV_REF(async_func) f)
- : fp_(boost::move(f.fp))
- , v0_(boost::move(f.a0))
- , v1_(boost::move(f.a1))
- , v2_(boost::move(f.a2))
- , v3_(boost::move(f.a3))
- , v4_(boost::move(f.a4))
- , v5_(boost::move(f.a5))
- , v6_(boost::move(f.a6))
- , v7_(boost::move(f.a7))
+ async_func(BOOST_THREAD_FWD_REF(async_func) f)
+ : fp_(boost::move(BOOST_THREAD_RV(f).fp))
+ , v0_(boost::move(BOOST_THREAD_RV(f).v0_))
+ , v1_(boost::move(BOOST_THREAD_RV(f).v1_))
+ , v2_(boost::move(BOOST_THREAD_RV(f).v2_))
+ , v3_(boost::move(BOOST_THREAD_RV(f).v3_))
+ , v4_(boost::move(BOOST_THREAD_RV(f).v4_))
+ , v5_(boost::move(BOOST_THREAD_RV(f).v5_))
+ , v6_(boost::move(BOOST_THREAD_RV(f).v6_))
+ , v7_(boost::move(BOOST_THREAD_RV(f).v7_))
{}
result_type operator()()
@@ -243,7 +338,7 @@
typedef typename result_of<Fp(T0, T1, T2, T3, T4, T5, T6)>::type result_type;
BOOST_SYMBOL_VISIBLE
- explicit async_func(BOOST_THREAD_RV_REF(Fp) f
+ explicit async_func(BOOST_THREAD_FWD_REF(Fp) f
, BOOST_THREAD_RV_REF(T0) a0
, BOOST_THREAD_RV_REF(T1) a1
, BOOST_THREAD_RV_REF(T2) a2
@@ -263,15 +358,15 @@
{}
BOOST_SYMBOL_VISIBLE
- async_func(BOOST_THREAD_RV_REF(async_func) f)
- : fp_(boost::move(f.fp))
- , v0_(boost::move(f.a0))
- , v1_(boost::move(f.a1))
- , v2_(boost::move(f.a2))
- , v3_(boost::move(f.a3))
- , v4_(boost::move(f.a4))
- , v5_(boost::move(f.a5))
- , v6_(boost::move(f.a6))
+ async_func(BOOST_THREAD_FWD_REF(async_func) f)
+ : fp_(boost::move(BOOST_THREAD_RV(f).fp))
+ , v0_(boost::move(BOOST_THREAD_RV(f).v0_))
+ , v1_(boost::move(BOOST_THREAD_RV(f).v1_))
+ , v2_(boost::move(BOOST_THREAD_RV(f).v2_))
+ , v3_(boost::move(BOOST_THREAD_RV(f).v3_))
+ , v4_(boost::move(BOOST_THREAD_RV(f).v4_))
+ , v5_(boost::move(BOOST_THREAD_RV(f).v5_))
+ , v6_(boost::move(BOOST_THREAD_RV(f).v6_))
{}
result_type operator()()
@@ -302,7 +397,7 @@
typedef typename result_of<Fp(T0, T1, T2, T3, T4, T5)>::type result_type;
BOOST_SYMBOL_VISIBLE
- explicit async_func(BOOST_THREAD_RV_REF(Fp) f
+ explicit async_func(BOOST_THREAD_FWD_REF(Fp) f
, BOOST_THREAD_RV_REF(T0) a0
, BOOST_THREAD_RV_REF(T1) a1
, BOOST_THREAD_RV_REF(T2) a2
@@ -320,14 +415,14 @@
{}
BOOST_SYMBOL_VISIBLE
- async_func(BOOST_THREAD_RV_REF(async_func) f)
- : fp_(boost::move(f.fp))
- , v0_(boost::move(f.a0))
- , v1_(boost::move(f.a1))
- , v2_(boost::move(f.a2))
- , v3_(boost::move(f.a3))
- , v4_(boost::move(f.a4))
- , v5_(boost::move(f.a5))
+ async_func(BOOST_THREAD_FWD_REF(async_func) f)
+ : fp_(boost::move(BOOST_THREAD_RV(f).fp))
+ , v0_(boost::move(BOOST_THREAD_RV(f).v0_))
+ , v1_(boost::move(BOOST_THREAD_RV(f).v1_))
+ , v2_(boost::move(BOOST_THREAD_RV(f).v2_))
+ , v3_(boost::move(BOOST_THREAD_RV(f).v3_))
+ , v4_(boost::move(BOOST_THREAD_RV(f).v4_))
+ , v5_(boost::move(BOOST_THREAD_RV(f).v5_))
{}
result_type operator()()
@@ -356,7 +451,7 @@
typedef typename result_of<Fp(T0, T1, T2, T3, T4)>::type result_type;
BOOST_SYMBOL_VISIBLE
- explicit async_func(BOOST_THREAD_RV_REF(Fp) f
+ explicit async_func(BOOST_THREAD_FWD_REF(Fp) f
, BOOST_THREAD_RV_REF(T0) a0
, BOOST_THREAD_RV_REF(T1) a1
, BOOST_THREAD_RV_REF(T2) a2
@@ -372,13 +467,13 @@
{}
BOOST_SYMBOL_VISIBLE
- async_func(BOOST_THREAD_RV_REF(async_func) f)
- : fp_(boost::move(f.fp))
- , v0_(boost::move(f.a0))
- , v1_(boost::move(f.a1))
- , v2_(boost::move(f.a2))
- , v3_(boost::move(f.a3))
- , v4_(boost::move(f.a4))
+ async_func(BOOST_THREAD_FWD_REF(async_func) f)
+ : fp_(boost::move(BOOST_THREAD_RV(f).fp))
+ , v0_(boost::move(BOOST_THREAD_RV(f).v0_))
+ , v1_(boost::move(BOOST_THREAD_RV(f).v1_))
+ , v2_(boost::move(BOOST_THREAD_RV(f).v2_))
+ , v3_(boost::move(BOOST_THREAD_RV(f).v3_))
+ , v4_(boost::move(BOOST_THREAD_RV(f).v4_))
{}
result_type operator()()
@@ -405,7 +500,7 @@
typedef typename result_of<Fp(T0, T1, T2, T3)>::type result_type;
BOOST_SYMBOL_VISIBLE
- explicit async_func(BOOST_THREAD_RV_REF(Fp) f
+ explicit async_func(BOOST_THREAD_FWD_REF(Fp) f
, BOOST_THREAD_RV_REF(T0) a0
, BOOST_THREAD_RV_REF(T1) a1
, BOOST_THREAD_RV_REF(T2) a2
@@ -419,12 +514,12 @@
{}
BOOST_SYMBOL_VISIBLE
- async_func(BOOST_THREAD_RV_REF(async_func) f)
- : fp_(boost::move(f.fp))
- , v0_(boost::move(f.a0))
- , v1_(boost::move(f.a1))
- , v2_(boost::move(f.a2))
- , v3_(boost::move(f.a3))
+ async_func(BOOST_THREAD_FWD_REF(async_func) f)
+ : fp_(boost::move(BOOST_THREAD_RV(f).fp))
+ , v0_(boost::move(BOOST_THREAD_RV(f).v0_))
+ , v1_(boost::move(BOOST_THREAD_RV(f).v1_))
+ , v2_(boost::move(BOOST_THREAD_RV(f).v2_))
+ , v3_(boost::move(BOOST_THREAD_RV(f).v3_))
{}
result_type operator()()
@@ -449,7 +544,7 @@
typedef typename result_of<Fp(T0, T1, T2)>::type result_type;
BOOST_SYMBOL_VISIBLE
- explicit async_func(BOOST_THREAD_RV_REF(Fp) f
+ explicit async_func(BOOST_THREAD_FWD_REF(Fp) f
, BOOST_THREAD_RV_REF(T0) a0
, BOOST_THREAD_RV_REF(T1) a1
, BOOST_THREAD_RV_REF(T2) a2
@@ -461,11 +556,11 @@
{}
BOOST_SYMBOL_VISIBLE
- async_func(BOOST_THREAD_RV_REF(async_func) f)
- : fp_(boost::move(f.fp))
- , v0_(boost::move(f.a0))
- , v1_(boost::move(f.a1))
- , v2_(boost::move(f.a2))
+ async_func(BOOST_THREAD_FWD_REF(async_func) f)
+ : fp_(boost::move(BOOST_THREAD_RV(f).fp))
+ , v0_(boost::move(BOOST_THREAD_RV(f).v0_))
+ , v1_(boost::move(BOOST_THREAD_RV(f).v1_))
+ , v2_(boost::move(BOOST_THREAD_RV(f).v2_))
{}
result_type operator()()
@@ -488,7 +583,7 @@
typedef typename result_of<Fp(T0, T1)>::type result_type;
BOOST_SYMBOL_VISIBLE
- explicit async_func(BOOST_THREAD_RV_REF(Fp) f
+ explicit async_func(BOOST_THREAD_FWD_REF(Fp) f
, BOOST_THREAD_RV_REF(T0) a0
, BOOST_THREAD_RV_REF(T1) a1
)
@@ -498,10 +593,10 @@
{}
BOOST_SYMBOL_VISIBLE
- async_func(BOOST_THREAD_RV_REF(async_func) f)
- : fp_(boost::move(f.fp))
- , v0_(boost::move(f.a0))
- , v1_(boost::move(f.a1))
+ async_func(BOOST_THREAD_FWD_REF(async_func) f)
+ : fp_(boost::move(BOOST_THREAD_RV(f).fp))
+ , v0_(boost::move(BOOST_THREAD_RV(f).v0_))
+ , v1_(boost::move(BOOST_THREAD_RV(f).v1_))
{}
result_type operator()()
@@ -522,7 +617,7 @@
typedef typename result_of<Fp(T0)>::type result_type;
BOOST_SYMBOL_VISIBLE
- explicit async_func(BOOST_THREAD_RV_REF(Fp) f
+ explicit async_func(BOOST_THREAD_FWD_REF(Fp) f
, BOOST_THREAD_RV_REF(T0) a0
)
: fp_(boost::move(f))
@@ -530,9 +625,9 @@
{}
BOOST_SYMBOL_VISIBLE
- async_func(BOOST_THREAD_RV_REF(async_func) f)
- : fp_(boost::move(f.fp))
- , v0_(boost::move(f.a0))
+ async_func(BOOST_THREAD_FWD_REF(async_func) f)
+ : fp_(boost::move(BOOST_THREAD_RV(f).fp))
+ , v0_(boost::move(BOOST_THREAD_RV(f).v0_))
{}
result_type operator()()
@@ -563,9 +658,34 @@
return fp_();
}
};
+ template <class R>
+ class async_func<R(*)()>
+ {
+ typedef R(*Fp)();
+ Fp fp_;
+ public:
+ BOOST_THREAD_COPYABLE_AND_MOVABLE(async_func)
+ typedef typename result_of<Fp()>::type result_type;
+ BOOST_SYMBOL_VISIBLE
+ explicit async_func(Fp f)
+ : fp_(f)
+ {}
+
+ BOOST_SYMBOL_VISIBLE
+ async_func(BOOST_THREAD_FWD_REF(async_func) f)
+ : fp_(f.fp_)
+ {}
+ result_type operator()()
+ {
+ return fp_();
+ }
+ };
+#endif
#endif
}
}
+#include <boost/thread/detail/variadic_footer.hpp>
+
#endif // header
Modified: branches/release/boost/thread/detail/config.hpp
==============================================================================
--- branches/release/boost/thread/detail/config.hpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/boost/thread/detail/config.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -15,8 +15,7 @@
//#define BOOST_THREAD_DONT_PROVIDE_INTERRUPTIONS
// ATTRIBUTE_MAY_ALIAS
-#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) > 302 \
- && !defined(__INTEL_COMPILER)
+#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
// GCC since 3.3 has may_alias attribute that helps to alleviate optimizer issues with
// regard to violation of the strict aliasing rules.
Modified: branches/release/boost/thread/detail/delete.hpp
==============================================================================
--- branches/release/boost/thread/detail/delete.hpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/boost/thread/detail/delete.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -15,6 +15,7 @@
* BOOST_THREAD_DELETE_COPY_ASSIGN deletes the copy assignment when the compiler supports it or
* makes it private.
*/
+
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
#define BOOST_THREAD_DELETE_COPY_CTOR(CLASS) \
CLASS(CLASS const&) = delete; \
Copied and modified: branches/release/boost/thread/detail/function_wrapper.hpp (from r85961, trunk/boost/thread/detail/function_wrapper.hpp)
==============================================================================
--- trunk/boost/thread/detail/function_wrapper.hpp Thu Sep 26 10:10:37 2013 (r85961, copy source)
+++ branches/release/boost/thread/detail/function_wrapper.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -14,7 +14,7 @@
#include <boost/thread/detail/memory.hpp>
#include <boost/thread/detail/move.hpp>
-#include <boost/interprocess/smart_ptr/unique_ptr.hpp>
+#include <boost/thread/csbl/memory/unique_ptr.hpp>
#include <memory>
#include <functional>
@@ -32,8 +32,8 @@
{
}
};
- //typedef boost::interprocess::unique_ptr<impl_base, boost::default_delete<impl_base> > impl_base_type;
- impl_base* impl;
+ typedef boost::csbl::unique_ptr<impl_base> impl_base_type;
+ impl_base_type impl;
template <typename F>
struct impl_type: impl_base
{
@@ -74,7 +74,6 @@
}
~function_wrapper()
{
- delete impl;
}
function_wrapper& operator=(BOOST_THREAD_RV_REF(function_wrapper) other) BOOST_NOEXCEPT
Modified: branches/release/boost/thread/detail/memory.hpp
==============================================================================
--- branches/release/boost/thread/detail/memory.hpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/boost/thread/detail/memory.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -13,14 +13,11 @@
#define BOOST_THREAD_DETAIL_MEMORY_HPP
#include <boost/config.hpp>
-#include <boost/container/allocator_traits.hpp>
-#include <boost/container/scoped_allocator.hpp>
-#include <boost/type_traits/remove_cv.hpp>
-#include <boost/type_traits/is_convertible.hpp>
-#include <boost/type_traits/is_scalar.hpp>
-#include <boost/type_traits/is_pointer.hpp>
-#include <boost/type_traits/is_same.hpp>
-#include <boost/static_assert.hpp>
+
+#include <boost/thread/csbl/memory/pointer_traits.hpp>
+#include <boost/thread/csbl/memory/allocator_arg.hpp>
+#include <boost/thread/csbl/memory/allocator_traits.hpp>
+#include <boost/thread/csbl/memory/scoped_allocator.hpp>
namespace boost
{
@@ -29,7 +26,7 @@
template <class _Alloc>
class allocator_destructor
{
- typedef container::allocator_traits<_Alloc> alloc_traits;
+ typedef csbl::allocator_traits<_Alloc> alloc_traits;
public:
typedef typename alloc_traits::pointer pointer;
typedef typename alloc_traits::size_type size_type;
@@ -47,111 +44,5 @@
}
};
} //namespace thread_detail
-
- typedef container::allocator_arg_t allocator_arg_t;
- BOOST_CONSTEXPR_OR_CONST allocator_arg_t allocator_arg = {};
-
- template <class T, class Alloc>
- struct uses_allocator: public container::uses_allocator<T, Alloc>
- {
- };
-
- template <class Ptr>
- struct pointer_traits
- {
- typedef Ptr pointer;
-// typedef <details> element_type;
-// typedef <details> difference_type;
-
-// template <class U> using rebind = <details>;
-//
-// static pointer pointer_to(<details>);
- };
-
- template <class T>
- struct pointer_traits<T*>
- {
- typedef T* pointer;
- typedef T element_type;
- typedef ptrdiff_t difference_type;
-
-// template <class U> using rebind = U*;
-//
-// static pointer pointer_to(<details>) noexcept;
- };
-
-
- namespace thread_detail {
- template <class _Ptr1, class _Ptr2,
- bool = is_same<typename remove_cv<typename pointer_traits<_Ptr1>::element_type>::type,
- typename remove_cv<typename pointer_traits<_Ptr2>::element_type>::type
- >::value
- >
- struct same_or_less_cv_qualified_imp
- : is_convertible<_Ptr1, _Ptr2> {};
-
- template <class _Ptr1, class _Ptr2>
- struct same_or_less_cv_qualified_imp<_Ptr1, _Ptr2, false>
- : false_type {};
-
- template <class _Ptr1, class _Ptr2, bool = is_scalar<_Ptr1>::value &&
- !is_pointer<_Ptr1>::value>
- struct same_or_less_cv_qualified
- : same_or_less_cv_qualified_imp<_Ptr1, _Ptr2> {};
-
- template <class _Ptr1, class _Ptr2>
- struct same_or_less_cv_qualified<_Ptr1, _Ptr2, true>
- : false_type {};
-
- }
- template <class T>
- struct BOOST_SYMBOL_VISIBLE default_delete
- {
- #ifndef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
- BOOST_SYMBOL_VISIBLE
- BOOST_CONSTEXPR default_delete() = default;
- #else
- BOOST_SYMBOL_VISIBLE
- BOOST_CONSTEXPR default_delete() BOOST_NOEXCEPT {}
- #endif
- template <class U>
- BOOST_SYMBOL_VISIBLE
- default_delete(const default_delete<U>&,
- typename enable_if<is_convertible<U*, T*> >::type* = 0) BOOST_NOEXCEPT {}
- BOOST_SYMBOL_VISIBLE
- void operator() (T* ptr) const BOOST_NOEXCEPT
- {
- BOOST_STATIC_ASSERT_MSG(sizeof(T) > 0, "default_delete can not delete incomplete type");
- delete ptr;
- }
- };
-
- template <class T>
- struct BOOST_SYMBOL_VISIBLE default_delete<T[]>
- {
- public:
- #ifndef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
- BOOST_SYMBOL_VISIBLE
- BOOST_CONSTEXPR default_delete() = default;
- #else
- BOOST_SYMBOL_VISIBLE
- BOOST_CONSTEXPR default_delete() BOOST_NOEXCEPT {}
- #endif
- template <class U>
- BOOST_SYMBOL_VISIBLE
- default_delete(const default_delete<U[]>&,
- typename enable_if<thread_detail::same_or_less_cv_qualified<U*, T*> >::type* = 0) BOOST_NOEXCEPT {}
- template <class U>
- BOOST_SYMBOL_VISIBLE
- void operator() (U* ptr,
- typename enable_if<thread_detail::same_or_less_cv_qualified<U*, T*> >::type* = 0) const BOOST_NOEXCEPT
- {
- BOOST_STATIC_ASSERT_MSG(sizeof(T) > 0, "default_delete can not delete incomplete type");
- delete [] ptr;
- }
- };
-
-} // namespace boost
-
-
+}
#endif // BOOST_THREAD_DETAIL_MEMORY_HPP
Modified: branches/release/boost/thread/detail/move.hpp
==============================================================================
--- branches/release/boost/thread/detail/move.hpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/boost/thread/detail/move.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -14,13 +14,22 @@
#include <boost/type_traits/remove_reference.hpp>
#include <boost/type_traits/remove_cv.hpp>
#include <boost/type_traits/decay.hpp>
+#include <boost/type_traits/conditional.hpp>
+#include <boost/type_traits/remove_extent.hpp>
+#include <boost/type_traits/is_array.hpp>
+#include <boost/type_traits/is_function.hpp>
+#include <boost/type_traits/remove_cv.hpp>
+#include <boost/type_traits/add_pointer.hpp>
+#include <boost/type_traits/decay.hpp>
#endif
#include <boost/thread/detail/delete.hpp>
#include <boost/move/utility.hpp>
#include <boost/move/traits.hpp>
#include <boost/config/abi_prefix.hpp>
-
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+#include <type_traits>
+#endif
namespace boost
{
@@ -237,8 +246,51 @@
namespace boost
-{ namespace thread_detail
+{
+ namespace thread_detail
+ {
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+ template <class Tp>
+ struct remove_reference : boost::remove_reference<Tp> {};
+ template <class Tp>
+ struct decay : boost::decay<Tp> {};
+#else
+ template <class Tp>
+ struct remove_reference
{
+ typedef Tp type;
+ };
+ template <class Tp>
+ struct remove_reference<Tp&>
+ {
+ typedef Tp type;
+ };
+ template <class Tp>
+ struct remove_reference< rv<Tp> > {
+ typedef Tp type;
+ };
+
+ template <class Tp>
+ struct decay
+ {
+ private:
+ typedef typename boost::move_detail::remove_rvalue_reference<Tp>::type Up0;
+ typedef typename boost::remove_reference<Up0>::type Up;
+ public:
+ typedef typename conditional
+ <
+ is_array<Up>::value,
+ typename remove_extent<Up>::type*,
+ typename conditional
+ <
+ is_function<Up>::value,
+ typename add_pointer<Up>::type,
+ typename remove_cv<Up>::type
+ >::type
+ >::type type;
+ };
+#endif
+
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template <class T>
typename decay<T>::type
Copied: branches/release/boost/thread/detail/nullary_function.hpp (from r86445, trunk/boost/thread/detail/nullary_function.hpp)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/boost/thread/detail/nullary_function.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770, copy of r86445, trunk/boost/thread/detail/nullary_function.hpp)
@@ -0,0 +1,213 @@
+// Copyright (C) 2013 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)
+//
+// 2013/09 Vicente J. Botet Escriba
+// Adapt to boost from CCIA C++11 implementation
+// Make use of Boost.Move
+
+#ifndef BOOST_THREAD_DETAIL_NULLARY_FUNCTION_HPP
+#define BOOST_THREAD_DETAIL_NULLARY_FUNCTION_HPP
+
+#include <boost/config.hpp>
+#include <boost/thread/detail/memory.hpp>
+#include <boost/thread/detail/move.hpp>
+#include <boost/smart_ptr/shared_ptr.hpp>
+#include <boost/type_traits/decay.hpp>
+
+namespace boost
+{
+ namespace detail
+ {
+
+ template <typename F>
+ class nullary_function;
+ template <>
+ class nullary_function<void()>
+ {
+ struct impl_base
+ {
+ virtual void call()=0;
+ virtual ~impl_base()
+ {
+ }
+ };
+ shared_ptr<impl_base> impl;
+ template <typename F>
+ struct impl_type: impl_base
+ {
+ F f;
+#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
+ impl_type(F &f_)
+ : f(f_)
+ {}
+#endif
+ impl_type(BOOST_THREAD_RV_REF(F) f_)
+ : f(boost::move(f_))
+ {}
+
+ void call()
+ {
+ f();
+ }
+ };
+ struct impl_type_ptr: impl_base
+ {
+ void (*f)();
+ impl_type_ptr(void (*f_)())
+ : f(f_)
+ {}
+ void call()
+ {
+ f();
+ }
+ };
+ public:
+ BOOST_THREAD_MOVABLE(nullary_function)
+
+ nullary_function(void (*f)()):
+ impl(new impl_type_ptr(f))
+ {}
+
+#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
+ template<typename F>
+ nullary_function(F& f):
+ impl(new impl_type<F>(f))
+ {}
+#endif
+ template<typename F>
+ nullary_function(BOOST_THREAD_RV_REF(F) f):
+ impl(new impl_type<typename decay<F>::type>(thread_detail::decay_copy(boost::forward<F>(f))))
+ {}
+
+ nullary_function()
+ : impl()
+ {
+ }
+ nullary_function(nullary_function const& other) BOOST_NOEXCEPT :
+ impl(other.impl)
+ {
+ }
+ nullary_function(BOOST_THREAD_RV_REF(nullary_function) other) BOOST_NOEXCEPT :
+ impl(BOOST_THREAD_RV(other).impl)
+ {
+ BOOST_THREAD_RV(other).impl.reset();
+ }
+ ~nullary_function()
+ {
+ }
+
+ nullary_function& operator=(nullary_function const& other) BOOST_NOEXCEPT
+ {
+ impl=other.impl;
+ return *this;
+ }
+ nullary_function& operator=(BOOST_THREAD_RV_REF(nullary_function) other) BOOST_NOEXCEPT
+ {
+ impl=BOOST_THREAD_RV(other).impl;
+ BOOST_THREAD_RV(other).impl.reset();
+ return *this;
+ }
+
+
+ void operator()()
+ { impl->call();}
+
+ };
+
+ template <typename R>
+ class nullary_function<R()>
+ {
+ struct impl_base
+ {
+ virtual R call()=0;
+ virtual ~impl_base()
+ {
+ }
+ };
+ shared_ptr<impl_base> impl;
+ template <typename F>
+ struct impl_type: impl_base
+ {
+ F f;
+#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
+ impl_type(F &f_)
+ : f(f_)
+ {}
+#endif
+ impl_type(BOOST_THREAD_RV_REF(F) f_)
+ : f(boost::move(f_))
+ {}
+
+ R call()
+ {
+ return f();
+ }
+ };
+ struct impl_type_ptr: impl_base
+ {
+ R (*f)();
+ impl_type_ptr(R (*f_)())
+ : f(f_)
+ {}
+
+ R call()
+ {
+ return f();
+ }
+ };
+ public:
+ BOOST_THREAD_MOVABLE(nullary_function)
+
+ nullary_function(R (*f)()):
+ impl(new impl_type_ptr(f))
+ {}
+#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
+ template<typename F>
+ nullary_function(F& f):
+ impl(new impl_type<F>(f))
+ {}
+#endif
+ template<typename F>
+ nullary_function(BOOST_THREAD_RV_REF(F) f):
+ impl(new impl_type<typename decay<F>::type>(thread_detail::decay_copy(boost::forward<F>(f))))
+ {}
+
+ nullary_function(nullary_function const& other) BOOST_NOEXCEPT :
+ impl(other.impl)
+ {
+ }
+ nullary_function(BOOST_THREAD_RV_REF(nullary_function) other) BOOST_NOEXCEPT :
+ impl(BOOST_THREAD_RV(other).impl)
+ {
+ BOOST_THREAD_RV(other).impl.reset();
+ }
+ nullary_function()
+ : impl()
+ {
+ }
+ ~nullary_function()
+ {
+ }
+
+ nullary_function& operator=(nullary_function const& other) BOOST_NOEXCEPT
+ {
+ impl=other.impl;
+ return *this;
+ }
+ nullary_function& operator=(BOOST_THREAD_RV_REF(nullary_function) other) BOOST_NOEXCEPT
+ {
+ impl=BOOST_THREAD_RV(other).impl;
+ BOOST_THREAD_RV(other).impl.reset();
+ return *this;
+ }
+
+ R operator()()
+ { return impl->call();}
+
+ };
+ }
+}
+
+#endif // header
Modified: branches/release/boost/thread/detail/thread.hpp
==============================================================================
--- branches/release/boost/thread/detail/thread.hpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/boost/thread/detail/thread.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -546,6 +546,7 @@
void detach();
static unsigned hardware_concurrency() BOOST_NOEXCEPT;
+ static unsigned physical_concurrency() BOOST_NOEXCEPT;
#define BOOST_THREAD_DEFINES_THREAD_NATIVE_HANDLE
typedef detail::thread_data_base::native_handle_type native_handle_type;
@@ -749,10 +750,10 @@
#endif
void thread::join() {
if (this_thread::get_id() == get_id())
- boost::throw_exception(thread_resource_error(system::errc::resource_deadlock_would_occur, "boost thread: trying joining itself"));
+ boost::throw_exception(thread_resource_error(static_cast<int>(system::errc::resource_deadlock_would_occur), "boost thread: trying joining itself"));
BOOST_THREAD_VERIFY_PRECONDITION( join_noexcept(),
- thread_resource_error(system::errc::invalid_argument, "boost thread: thread not joinable")
+ thread_resource_error(static_cast<int>(system::errc::invalid_argument), "boost thread: thread not joinable")
);
}
@@ -763,7 +764,7 @@
#endif
{
if (this_thread::get_id() == get_id())
- boost::throw_exception(thread_resource_error(system::errc::resource_deadlock_would_occur, "boost thread: trying joining itself"));
+ boost::throw_exception(thread_resource_error(static_cast<int>(system::errc::resource_deadlock_would_occur), "boost thread: trying joining itself"));
bool res;
if (do_try_join_until_noexcept(timeout, res))
{
@@ -772,7 +773,7 @@
else
{
BOOST_THREAD_THROW_ELSE_RETURN(
- (thread_resource_error(system::errc::invalid_argument, "boost thread: thread not joinable")),
+ (thread_resource_error(static_cast<int>(system::errc::invalid_argument), "boost thread: thread not joinable")),
false
);
}
Modified: branches/release/boost/thread/detail/thread_group.hpp
==============================================================================
--- branches/release/boost/thread/detail/thread_group.hpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/boost/thread/detail/thread_group.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -85,7 +85,7 @@
if(thrd)
{
BOOST_THREAD_ASSERT_PRECONDITION( ! is_thread_in(thrd) ,
- thread_resource_error(system::errc::resource_deadlock_would_occur, "boost::thread_group: trying to add a duplicated thread")
+ thread_resource_error(static_cast<int>(system::errc::resource_deadlock_would_occur), "boost::thread_group: trying to add a duplicated thread")
);
boost::lock_guard<shared_mutex> guard(m);
@@ -106,7 +106,7 @@
void join_all()
{
BOOST_THREAD_ASSERT_PRECONDITION( ! is_this_thread_in() ,
- thread_resource_error(system::errc::resource_deadlock_would_occur, "boost::thread_group: trying joining itself")
+ thread_resource_error(static_cast<int>(system::errc::resource_deadlock_would_occur), "boost::thread_group: trying joining itself")
);
boost::shared_lock<shared_mutex> guard(m);
Copied: branches/release/boost/thread/detail/variadic_footer.hpp (from r86658, trunk/boost/thread/detail/variadic_footer.hpp)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/boost/thread/detail/variadic_footer.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770, copy of r86658, trunk/boost/thread/detail/variadic_footer.hpp)
@@ -0,0 +1,10 @@
+// Copyright (C) 2013 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)
+
+
+#if defined BOOST_NO_CXX11_VARIADIC_TEMPLATES
+
+
+#endif
Copied and modified: branches/release/boost/thread/detail/variadic_header.hpp (from r86658, trunk/boost/thread/detail/variadic_header.hpp)
==============================================================================
--- trunk/boost/thread/detail/variadic_header.hpp Tue Nov 12 13:35:19 2013 (r86658, copy source)
+++ branches/release/boost/thread/detail/variadic_header.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -6,12 +6,13 @@
#include <boost/config.hpp>
#if defined BOOST_NO_CXX11_VARIADIC_TEMPLATES
+
#include <boost/preprocessor/facilities/intercept.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
+
#ifndef BOOST_THREAD_MAX_ARGS
#define BOOST_THREAD_MAX_ARGS 9
-#define BOOST_THREAD_MAX_ARGS_P1 10
#endif
#endif
Copied and modified: branches/release/boost/thread/detail/work.hpp (from r86445, trunk/boost/thread/detail/work.hpp)
==============================================================================
--- trunk/boost/thread/detail/work.hpp Sat Oct 26 07:44:21 2013 (r86445, copy source)
+++ branches/release/boost/thread/detail/work.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -7,24 +7,15 @@
#ifndef BOOST_THREAD_DETAIL_WORK_HPP
#define BOOST_THREAD_DETAIL_WORK_HPP
-#define BOOST_THREAD_USES_NULLARY_FUNCTION_AS_WORK
-#ifdef BOOST_THREAD_USES_NULLARY_FUNCTION_AS_WORK
#include <boost/thread/detail/nullary_function.hpp>
-#else
-#include <boost/thread/detail/function_wrapper.hpp>
-#endif
namespace boost
{
namespace thread_detail
{
-#ifdef BOOST_THREAD_USES_NULLARY_FUNCTION_AS_WORK
typedef detail::nullary_function<void()> work;
-#else
- typedef detail::function_wrapper work;
-#endif
}
} // namespace boost
Modified: branches/release/boost/thread/exceptions.hpp
==============================================================================
--- branches/release/boost/thread/exceptions.hpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/boost/thread/exceptions.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -124,7 +124,7 @@
typedef thread_exception base_type;
public:
thread_resource_error()
- : base_type(system::errc::resource_unavailable_try_again, "boost::thread_resource_error")
+ : base_type(static_cast<int>(system::errc::resource_unavailable_try_again), "boost::thread_resource_error")
{}
thread_resource_error( int ev )
@@ -152,7 +152,7 @@
typedef thread_exception base_type;
public:
unsupported_thread_option()
- : base_type(system::errc::invalid_argument, "boost::unsupported_thread_option")
+ : base_type(static_cast<int>(system::errc::invalid_argument), "boost::unsupported_thread_option")
{}
unsupported_thread_option( int ev )
@@ -176,7 +176,7 @@
typedef thread_exception base_type;
public:
invalid_thread_argument()
- : base_type(system::errc::invalid_argument, "boost::invalid_thread_argument")
+ : base_type(static_cast<int>(system::errc::invalid_argument), "boost::invalid_thread_argument")
{}
invalid_thread_argument( int ev )
@@ -200,7 +200,7 @@
typedef thread_exception base_type;
public:
thread_permission_error()
- : base_type(system::errc::permission_denied, "boost::thread_permission_error")
+ : base_type(static_cast<int>(system::errc::permission_denied), "boost::thread_permission_error")
{}
thread_permission_error( int ev )
Copied and modified: branches/release/boost/thread/executor.hpp (from r86161, trunk/boost/thread/executor.hpp)
==============================================================================
--- trunk/boost/thread/executor.hpp Fri Oct 4 16:05:26 2013 (r86161, copy source)
+++ branches/release/boost/thread/executor.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -14,8 +14,7 @@
#include <boost/thread/detail/delete.hpp>
#include <boost/thread/detail/move.hpp>
-#include <boost/thread/detail/function_wrapper.hpp>
-
+#include <boost/thread/detail/work.hpp>
#include <boost/config/abi_prefix.hpp>
@@ -26,7 +25,7 @@
{
public:
/// type-erasure to store the works to do
- typedef detail::function_wrapper work;
+ typedef thread_detail::work work;
/// executor is not copyable.
BOOST_THREAD_NO_COPYABLE(executor)
@@ -72,14 +71,20 @@
* \b Throws: \c sync_queue_is_closed if the thread pool is closed.
* Whatever exception that can be throw while storing the closure.
*/
-//#if ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
+
+#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template <typename Closure>
- void submit(Closure const& closure)
+ void submit(Closure & closure)
+ {
+ work w ((closure));
+ submit(boost::move(w));
+ }
+#endif
+ void submit(void (*closure)())
{
work w ((closure));
submit(boost::move(w));
}
-//#endif
template <typename Closure>
void submit(BOOST_THREAD_RV_REF(Closure) closure)
@@ -113,13 +118,17 @@
return true;
}
};
+
+ /**
+ * Polymorphic adaptor of a model of Executor to an executor.
+ */
template <typename Executor>
class executor_adaptor : public executor
{
Executor ex;
public:
/// type-erasure to store the works to do
- typedef detail::function_wrapper work;
+ typedef executor::work work;
/// executor is not copyable.
BOOST_THREAD_NO_COPYABLE(executor_adaptor)
@@ -127,15 +136,45 @@
/**
* executor_adaptor constructor
*/
- executor_adaptor() : ex() {}
-
- /**
- * executor_adaptor constructor
- */
#if ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template <typename ...Args>
executor_adaptor(BOOST_THREAD_RV_REF(Args) ... args) : ex(boost::forward<Args>(args)...) {}
+#else
+ /**
+ * executor_adaptor constructor
+ */
+ executor_adaptor() : ex() {}
+
+ template <typename A1>
+ executor_adaptor(
+ BOOST_THREAD_FWD_REF(A1) a1
+ ) :
+ ex(
+ boost::forward<A1>(a1)
+ ) {}
+ template <typename A1, typename A2>
+ executor_adaptor(
+ BOOST_THREAD_FWD_REF(A1) a1,
+ BOOST_THREAD_FWD_REF(A2) a2
+ ) :
+ ex(
+ boost::forward<A1>(a1),
+ boost::forward<A2>(a2)
+ ) {}
+ template <typename A1, typename A2, typename A3>
+ executor_adaptor(
+ BOOST_THREAD_FWD_REF(A1) a1,
+ BOOST_THREAD_FWD_REF(A2) a2,
+ BOOST_THREAD_FWD_REF(A3) a3
+ ) :
+ ex(
+ boost::forward<A1>(a1),
+ boost::forward<A2>(a2),
+ boost::forward<A3>(a3)
+ ) {}
#endif
+ Executor& underlying_executor() { return ex; }
+
/**
* \b Effects: close the \c executor for submissions.
* The worker threads will work until there is no more closures to run.
@@ -156,8 +195,30 @@
* \b Throws: \c sync_queue_is_closed if the thread pool is closed.
* Whatever exception that can be throw while storing the closure.
*/
- void submit(BOOST_THREAD_RV_REF(work) closure) { return ex.submit(boost::move(closure)); }
+ void submit(BOOST_THREAD_RV_REF(work) closure) {
+ return ex.submit(boost::move(closure));
+ }
+
+#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
+ template <typename Closure>
+ void submit(Closure & closure)
+ {
+ work w ((closure));
+ submit(boost::move(w));
+ }
+#endif
+ void submit(void (*closure)())
+ {
+ work w ((closure));
+ submit(boost::move(w));
+ }
+ template <typename Closure>
+ void submit(BOOST_THREAD_RV_REF(Closure) closure)
+ {
+ work w =boost::move(closure);
+ submit(boost::move(w));
+ }
/**
* Effects: try to execute one task.
Modified: branches/release/boost/thread/externally_locked.hpp
==============================================================================
--- branches/release/boost/thread/externally_locked.hpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/boost/thread/externally_locked.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -97,7 +97,7 @@
/// move assignment
externally_locked& operator=(BOOST_THREAD_RV_REF(externally_locked) rhs) // BOOST_NOEXCEPT
{
- obj_=move(rhs.obj_);
+ obj_=move(BOOST_THREAD_RV(rhs).obj_);
mtx_=rhs.mtx_;
return *this;
}
Modified: branches/release/boost/thread/future.hpp
==============================================================================
--- branches/release/boost/thread/future.hpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/boost/thread/future.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -15,7 +15,6 @@
#ifndef BOOST_NO_EXCEPTIONS
-//#include <boost/thread/detail/log.hpp>
#include <boost/detail/scoped_enum_emulation.hpp>
#include <stdexcept>
#include <boost/thread/detail/move.hpp>
@@ -30,8 +29,7 @@
#include <boost/scoped_ptr.hpp>
#include <boost/type_traits/is_fundamental.hpp>
#include <boost/thread/detail/is_convertible.hpp>
-#include <boost/type_traits/remove_reference.hpp>
-#include <boost/type_traits/remove_cv.hpp>
+#include <boost/type_traits/decay.hpp>
#include <boost/type_traits/is_void.hpp>
#include <boost/mpl/if.hpp>
#include <boost/config.hpp>
@@ -54,11 +52,20 @@
#if defined BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS
#include <boost/thread/detail/memory.hpp>
+#include <boost/container/scoped_allocator.hpp>
+#if ! defined BOOST_NO_CXX11_ALLOCATOR
+#include <memory>
+#endif
#endif
#include <boost/utility/result_of.hpp>
#include <boost/thread/thread_only.hpp>
+#if defined BOOST_THREAD_PROVIDES_FUTURE_WHEN_ALL_WHEN_ANY
+#include <boost/thread/csbl/tuple.hpp>
+#include <boost/thread/csbl/vector.hpp>
+#endif
+
#if defined BOOST_THREAD_PROVIDES_FUTURE
#define BOOST_THREAD_FUTURE future
#else
@@ -74,6 +81,9 @@
none = 0,
async = 1,
deferred = 2,
+#ifdef BOOST_THREAD_PROVIDES_EXECUTORS
+ executor = 4,
+#endif
any = async | deferred
}
BOOST_SCOPED_ENUM_DECLARE_END(launch)
@@ -244,7 +254,13 @@
is_deferred_ = false;
policy_ = launch::async;
}
-
+#ifdef BOOST_THREAD_PROVIDES_EXECUTORS
+ void set_executor()
+ {
+ is_deferred_ = false;
+ policy_ = launch::executor;
+ }
+#endif
waiter_list::iterator register_external_waiter(boost::condition_variable_any& cv)
{
boost::unique_lock<boost::mutex> lock(mutex);
@@ -1493,6 +1509,7 @@
typedef typename detail::future_traits<R>::move_dest_type move_dest_type;
+ public: // when_all
BOOST_THREAD_FUTURE(future_ptr a_future):
base_type(a_future)
@@ -2441,17 +2458,27 @@
}
};
-
+}
#if defined BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS
- namespace container
+namespace boost { namespace container {
+ template <class R, class Alloc>
+ struct uses_allocator< ::boost::promise<R> , Alloc> : true_type
{
- template <class R, class Alloc>
- struct uses_allocator<promise<R> , Alloc> : true_type
- {
- };
- }
+ };
+}}
+#if ! defined BOOST_NO_CXX11_ALLOCATOR
+namespace std {
+ template <class R, class Alloc>
+ struct uses_allocator< ::boost::promise<R> , Alloc> : true_type
+ {
+ };
+}
+#endif
#endif
+namespace boost
+{
+
BOOST_THREAD_DCL_MOVABLE_BEG(T) promise<T> BOOST_THREAD_DCL_MOVABLE_END
namespace detail
@@ -2733,11 +2760,17 @@
private:
task_shared_state(task_shared_state&);
public:
+#if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK && defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
+ R (*f)(BOOST_THREAD_RV_REF(ArgTypes) ... );
+ task_shared_state(R (*f_)(BOOST_THREAD_RV_REF(ArgTypes) ... )):
+ f(f_)
+ {}
+#else
R (*f)();
task_shared_state(R (*f_)()):
f(f_)
{}
-
+#endif
#if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK && defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
void do_apply(BOOST_THREAD_RV_REF(ArgTypes) ... args)
@@ -2815,11 +2848,17 @@
private:
task_shared_state(task_shared_state&);
public:
+#if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK && defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
+ R& (*f)(BOOST_THREAD_RV_REF(ArgTypes) ... );
+ task_shared_state(R& (*f_)(BOOST_THREAD_RV_REF(ArgTypes) ... )):
+ f(f_)
+ {}
+#else
R& (*f)();
task_shared_state(R& (*f_)()):
f(f_)
{}
-
+#endif
#if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK && defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
void do_apply(BOOST_THREAD_RV_REF(ArgTypes) ... args)
@@ -3108,7 +3147,8 @@
, typename boost::disable_if<is_same<typename decay<F>::type, packaged_task>, dummy* >::type=0
)
{
- typedef typename remove_cv<typename remove_reference<F>::type>::type FR;
+ //typedef typename remove_cv<typename remove_reference<F>::type>::type FR;
+ typedef typename decay<F>::type FR;
#if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK
#if defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
typedef detail::task_shared_state<FR,R(ArgTypes...)> task_shared_state_type;
@@ -3189,7 +3229,9 @@
template <class F, class Allocator>
packaged_task(boost::allocator_arg_t, Allocator a, BOOST_THREAD_FWD_REF(F) f)
{
- typedef typename remove_cv<typename remove_reference<F>::type>::type FR;
+ //typedef typename remove_cv<typename remove_reference<F>::type>::type FR;
+ typedef typename decay<F>::type FR;
+
#if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK
#if defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
typedef detail::task_shared_state<FR,R(ArgTypes...)> task_shared_state_type;
@@ -3366,16 +3408,26 @@
task->set_wait_callback(f,this);
}
};
-
+}
#if defined BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS
- namespace container
+namespace boost { namespace container {
+ template <class R, class Alloc>
+ struct uses_allocator< ::boost::packaged_task<R> , Alloc> : true_type
{
- template <class R, class Alloc>
- struct uses_allocator<packaged_task<R>, Alloc>
- : public true_type {};
- }
+ };
+}}
+#if ! defined BOOST_NO_CXX11_ALLOCATOR
+namespace std {
+ template <class R, class Alloc>
+ struct uses_allocator< ::boost::packaged_task<R> , Alloc> : true_type
+ {
+ };
+}
+#endif
#endif
+namespace boost
+{
BOOST_THREAD_DCL_MOVABLE_BEG(T) packaged_task<T> BOOST_THREAD_DCL_MOVABLE_END
namespace detail
@@ -3559,6 +3611,248 @@
}
}
+#ifdef BOOST_THREAD_PROVIDES_EXECUTORS
+ namespace detail {
+ /////////////////////////
+ /// shared_state_nullary_task
+ /////////////////////////
+ template<typename Rp, typename Fp>
+ struct shared_state_nullary_task
+ {
+ shared_state<Rp>* that;
+ Fp f_;
+ public:
+ shared_state_nullary_task(shared_state<Rp>* st, BOOST_THREAD_FWD_REF(Fp) f)
+ : that(st), f_(boost::forward<Fp>(f))
+ {};
+ void operator()()
+ {
+ try
+ {
+ that->mark_finished_with_result(f_());
+ }
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
+ catch(thread_interrupted& )
+ {
+ that->mark_interrupted_finish();
+ }
+#endif
+ catch(...)
+ {
+ that->mark_exceptional_finish();
+ }
+
+ }
+ };
+
+ template<typename Fp>
+ struct shared_state_nullary_task<void, Fp>
+ {
+ shared_state<void>* that;
+ Fp f_;
+ public:
+ shared_state_nullary_task(shared_state<void>* st, BOOST_THREAD_FWD_REF(Fp) f)
+ : that(st), f_(boost::forward<Fp>(f))
+ {};
+ void operator()()
+ {
+ try
+ {
+ f_();
+ that->mark_finished_with_result();
+ }
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
+ catch(thread_interrupted& )
+ {
+ that->mark_interrupted_finish();
+ }
+#endif
+ catch(...)
+ {
+ that->mark_exceptional_finish();
+ }
+ }
+ };
+
+ template<typename Rp, typename Fp>
+ struct shared_state_nullary_task<Rp&, Fp>
+ {
+ shared_state<Rp&>* that;
+ Fp f_;
+ public:
+ shared_state_nullary_task(shared_state<Rp&>* st, BOOST_THREAD_FWD_REF(Fp) f)
+ : that(st), f_(boost::forward<Fp>(f))
+ {};
+ void operator()()
+ {
+ try
+ {
+ that->mark_finished_with_result(f_());
+ }
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
+ catch(thread_interrupted& )
+ {
+ that->mark_interrupted_finish();
+ }
+#endif
+ catch(...)
+ {
+ that->mark_exceptional_finish();
+ }
+ }
+ };
+
+ /////////////////////////
+ /// future_executor_shared_state_base
+ /////////////////////////
+ template<typename Rp, typename Executor>
+ struct future_executor_shared_state: shared_state<Rp>
+ {
+ typedef shared_state<Rp> base_type;
+ protected:
+ //Executor& ex_;
+ public:
+ template<typename Fp>
+ future_executor_shared_state(Executor& ex, BOOST_THREAD_FWD_REF(Fp) f)
+ //: ex_(ex)
+ {
+ this->set_executor();
+ shared_state_nullary_task<Rp,Fp> t(this, boost::forward<Fp>(f));
+ ex.submit(boost::move(t));
+ }
+
+ ~future_executor_shared_state()
+ {
+ this->wait(false);
+ }
+ };
+
+ ////////////////////////////////
+ // make_future_executor_shared_state
+ ////////////////////////////////
+ template <class Rp, class Fp, class Executor>
+ BOOST_THREAD_FUTURE<Rp>
+ make_future_executor_shared_state(Executor& ex, BOOST_THREAD_FWD_REF(Fp) f)
+ {
+ shared_ptr<future_executor_shared_state<Rp, Executor> >
+ h(new future_executor_shared_state<Rp, Executor>(ex, boost::forward<Fp>(f)));
+ return BOOST_THREAD_FUTURE<Rp>(h);
+ }
+
+ } // detail
+
+ ////////////////////////////////
+ // template <class Executor, class F, class... ArgTypes>
+ // future<R> async(Executor& ex, F&&, ArgTypes&&...);
+ ////////////////////////////////
+
+ #if ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+ #if defined BOOST_THREAD_RVALUE_REFERENCES_DONT_MATCH_FUNTION_PTR
+
+ template <class Executor, class R, class... ArgTypes>
+ BOOST_THREAD_FUTURE<R>
+ async(Executor& ex, R(*f)(BOOST_THREAD_FWD_REF(ArgTypes)...), BOOST_THREAD_FWD_REF(ArgTypes)... args)
+ {
+ typedef R(*F)(BOOST_THREAD_FWD_REF(ArgTypes)...);
+ typedef detail::async_func<typename decay<F>::type, typename decay<ArgTypes>::type...> BF;
+ typedef typename BF::result_type Rp;
+
+ return BOOST_THREAD_MAKE_RV_REF(boost::detail::make_future_executor_shared_state<Rp>(ex,
+ BF(
+ thread_detail::decay_copy(boost::forward<F>(f))
+ , thread_detail::decay_copy(boost::forward<ArgTypes>(args))...
+ )
+ ));
+ }
+ #endif // defined BOOST_THREAD_RVALUE_REFERENCES_DONT_MATCH_FUNTION_PTR
+
+ template <class Executor, class F, class ...ArgTypes>
+ BOOST_THREAD_FUTURE<typename boost::result_of<typename decay<F>::type(
+ typename decay<ArgTypes>::type...
+ )>::type>
+ async(Executor& ex, BOOST_THREAD_FWD_REF(F) f, BOOST_THREAD_FWD_REF(ArgTypes)... args)
+ {
+ typedef detail::async_func<typename decay<F>::type, typename decay<ArgTypes>::type...> BF;
+ typedef typename BF::result_type Rp;
+
+ return BOOST_THREAD_MAKE_RV_REF(boost::detail::make_future_executor_shared_state<Rp>(ex,
+ BF(
+ thread_detail::decay_copy(boost::forward<F>(f))
+ , thread_detail::decay_copy(boost::forward<ArgTypes>(args))...
+ )
+ ));
+ }
+ #else // ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+ #if defined BOOST_THREAD_RVALUE_REFERENCES_DONT_MATCH_FUNTION_PTR
+
+ template <class Executor, class R>
+ BOOST_THREAD_FUTURE<R>
+ async(Executor& ex, R(*f)())
+ {
+ typedef R(*F)();
+ typedef detail::async_func<F> BF;
+ typedef typename BF::result_type Rp;
+
+ return BOOST_THREAD_MAKE_RV_REF(boost::detail::make_future_executor_shared_state<Rp>(ex,
+ BF(
+ f
+ )
+ ));
+ }
+
+ template <class Executor, class R, class A1>
+ BOOST_THREAD_FUTURE<R>
+ async(Executor& ex, R(*f)(BOOST_THREAD_FWD_REF(A1)), BOOST_THREAD_FWD_REF(A1) a1)
+ {
+ typedef R(*F)(BOOST_THREAD_FWD_REF(A1));
+ typedef detail::async_func<F, typename decay<A1>::type> BF;
+ typedef typename BF::result_type Rp;
+
+ return BOOST_THREAD_MAKE_RV_REF(boost::detail::make_future_executor_shared_state<Rp>(ex,
+ BF(
+ f
+ , thread_detail::decay_copy(boost::forward<A1>(a1))
+ )
+ ));
+ }
+
+ #endif // defined BOOST_THREAD_RVALUE_REFERENCES_DONT_MATCH_FUNTION_PTR
+ template <class Executor, class F>
+ BOOST_THREAD_FUTURE<typename boost::result_of<typename decay<F>::type()>::type>
+ async(Executor& ex, BOOST_THREAD_FWD_REF(F) f)
+ {
+ typedef detail::async_func<typename decay<F>::type> BF;
+ typedef typename BF::result_type Rp;
+
+ return boost::detail::make_future_executor_shared_state<Rp>(ex,
+ BF(
+ thread_detail::decay_copy(boost::forward<F>(f))
+ )
+ );
+ }
+
+ template <class Executor, class F, class A1>
+ BOOST_THREAD_FUTURE<typename boost::result_of<typename decay<F>::type(
+ typename decay<A1>::type
+ )>::type>
+ async(Executor& ex, BOOST_THREAD_FWD_REF(F) f, BOOST_THREAD_FWD_REF(A1) a1)
+ {
+ typedef detail::async_func<typename decay<F>::type, typename decay<A1>::type> BF;
+ typedef typename BF::result_type Rp;
+
+ return BOOST_THREAD_MAKE_RV_REF(boost::detail::make_future_executor_shared_state<Rp>(ex,
+ BF(
+ thread_detail::decay_copy(boost::forward<F>(f))
+ , thread_detail::decay_copy(boost::forward<A1>(a1))
+ )
+ ));
+ }
+
+ #endif //! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+
+
+#endif
+
////////////////////////////////
// template <class F, class... ArgTypes>
// future<R> async(F&&, ArgTypes&&...);
@@ -4235,6 +4529,307 @@
return boost::detail::make_future_unwrap_shared_state<BOOST_THREAD_FUTURE<BOOST_THREAD_FUTURE<R2> >, R2>(lock, boost::move(*this));
}
#endif
+
+#if defined BOOST_THREAD_PROVIDES_FUTURE_WHEN_ALL_WHEN_ANY
+ namespace detail
+ {
+
+ struct input_iterator_tag
+ {
+ };
+ struct vector_tag
+ {
+ };
+ struct values_tag
+ {
+ };
+ template <typename T>
+ struct alias_t { typedef T type; };
+
+ BOOST_CONSTEXPR_OR_CONST input_iterator_tag input_iterator_tag_value = {};
+ BOOST_CONSTEXPR_OR_CONST vector_tag vector_tag_value = {};
+ BOOST_CONSTEXPR_OR_CONST values_tag values_tag_value = {};
+ ////////////////////////////////
+ // detail::future_async_when_all_shared_state
+ ////////////////////////////////
+ template<typename F>
+ struct future_when_all_vector_shared_state: future_async_shared_state_base<csbl::vector<F> >
+ {
+ typedef csbl::vector<F> vector_type;
+ typedef typename F::value_type value_type;
+ csbl::vector<F> vec_;
+
+ static void run(future_when_all_vector_shared_state* that)
+ {
+ try
+ {
+ boost::wait_for_all(that->vec_.begin(), that->vec_.end());
+ that->mark_finished_with_result(boost::move(that->vec_));
+ }
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
+ catch(thread_interrupted& )
+ {
+ that->mark_interrupted_finish();
+ }
+#endif
+ catch(...)
+ {
+ that->mark_exceptional_finish();
+ }
+ }
+ void init()
+ {
+ this->thr_ = thread(&future_when_all_vector_shared_state::run, this);
+ }
+
+ public:
+ template< typename InputIterator>
+ future_when_all_vector_shared_state(input_iterator_tag,
+ InputIterator first, InputIterator last
+ )
+ : vec_(std::make_move_iterator(first), std::make_move_iterator(last))
+ {
+ init();
+ }
+
+ future_when_all_vector_shared_state(vector_tag,
+ BOOST_THREAD_RV_REF(csbl::vector<F>) v
+ )
+ : vec_(boost::move(v))
+ {
+ init();
+ }
+
+#if ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+ template< typename T0, typename ...T>
+ future_when_all_vector_shared_state(values_tag,
+ BOOST_THREAD_RV_REF(T0) f, BOOST_THREAD_RV_REF(T) ... futures
+ )
+ {
+ vec_.push_back(boost::forward<T0>(f));
+ typename alias_t<char[]>::type{
+ ( //first part of magic unpacker
+ vec_.push_back(boost::forward<T>(futures))
+ ,'0'
+ )...,
+ '0'
+ }; //second part of magic unpacker
+
+ init();
+ }
+#else
+#endif
+ ~future_when_all_vector_shared_state()
+ {
+ this->join();
+ }
+
+ };
+
+ ////////////////////////////////
+ // detail::future_async_when_any_shared_state
+ ////////////////////////////////
+ template<typename F>
+ struct future_when_any_vector_shared_state: future_async_shared_state_base<csbl::vector<F> >
+ {
+ typedef csbl::vector<F> vector_type;
+ typedef typename F::value_type value_type;
+ csbl::vector<F> vec_;
+
+ static void run(future_when_any_vector_shared_state* that)
+ {
+ try
+ {
+ boost::wait_for_any(that->vec_.begin(), that->vec_.end());
+ that->mark_finished_with_result(boost::move(that->vec_));
+ }
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
+ catch(thread_interrupted& )
+ {
+ that->mark_interrupted_finish();
+ }
+#endif
+ catch(...)
+ {
+ that->mark_exceptional_finish();
+ }
+ }
+ void init()
+ {
+ this->thr_ = thread(&future_when_any_vector_shared_state::run, this);
+ }
+
+ public:
+ template< typename InputIterator>
+ future_when_any_vector_shared_state(input_iterator_tag,
+ InputIterator first, InputIterator last
+ )
+ : vec_(std::make_move_iterator(first), std::make_move_iterator(last))
+ {
+ init();
+ }
+
+ future_when_any_vector_shared_state(vector_tag,
+ BOOST_THREAD_RV_REF(csbl::vector<F>) v
+ )
+ : vec_(boost::move(v))
+ {
+ init();
+ }
+
+#if ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+ template< typename T0, typename ...T>
+ future_when_any_vector_shared_state(values_tag,
+ BOOST_THREAD_RV_REF(T0) f, BOOST_THREAD_RV_REF(T) ... futures
+ )
+ {
+ vec_.push_back(boost::forward<T0>(f));
+ typename alias_t<char[]>::type{
+ ( //first part of magic unpacker
+ vec_.push_back(boost::forward<T>(futures))
+ ,'0'
+ )...,
+ '0'
+ }; //second part of magic unpacker
+ init();
+ }
+#endif
+
+ ~future_when_any_vector_shared_state()
+ {
+ this->join();
+ }
+
+ };
+
+#if ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+//#if ! defined(BOOST_NO_CXX11_HDR_TUPLE)
+ template< typename T0, typename ...T>
+ struct future_when_all_tuple_shared_state: future_async_shared_state_base<
+ csbl::tuple<BOOST_THREAD_FUTURE<typename T0::value_type>, BOOST_THREAD_FUTURE<typename T::value_type>... >
+ >
+ {
+
+ };
+ template< typename T0, typename ...T>
+ struct future_when_any_tuple_shared_state: future_async_shared_state_base<
+ csbl::tuple<BOOST_THREAD_FUTURE<typename T0::value_type>, BOOST_THREAD_FUTURE<typename T::value_type>... >
+ >
+ {
+
+ };
+//#endif
+#endif
+
+#if ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+ template< typename ...T>
+ struct are_same : true_type {};
+ template< typename T0 >
+ struct are_same<T0> : true_type {};
+ template< typename T0, typename T1, typename ...T>
+ struct are_same<T0, T1, T...> : integral_constant<bool, is_same<T0,T1>::value && are_same<T1, T...>::value> {};
+
+ template< bool AreSame, typename T0, typename ...T>
+ struct when_type_impl;
+
+ template< typename T0, typename ...T>
+ struct when_type_impl<true, T0, T...>
+ {
+ typedef csbl::vector<typename decay<T0>::type> container_type;
+ typedef typename container_type::value_type value_type;
+ typedef detail::future_when_all_vector_shared_state<value_type> factory_all_type;
+ typedef detail::future_when_any_vector_shared_state<value_type> factory_any_type;
+ };
+//#if ! defined(BOOST_NO_CXX11_HDR_TUPLE)
+ template< typename T0, typename ...T>
+ struct when_type_impl<false, T0, T...>
+ {
+ typedef csbl::tuple<BOOST_THREAD_FUTURE<typename T0::value_type>, BOOST_THREAD_FUTURE<typename T::value_type>... > container_type;
+ typedef detail::future_when_all_tuple_shared_state<T0, T...> factory_all_type;
+ typedef detail::future_when_any_tuple_shared_state<T0, T...> factory_any_type;
+ };
+//#endif
+
+ template< typename T0, typename ...T>
+ struct when_type : when_type_impl<are_same<T0, T...>::value, T0, T...> {};
+#endif
+ }
+
+ template< typename InputIterator>
+ typename boost::disable_if<is_future_type<InputIterator>,
+ BOOST_THREAD_FUTURE<csbl::vector<typename InputIterator::value_type> >
+ >::type
+ when_all(InputIterator first, InputIterator last)
+ {
+ typedef typename InputIterator::value_type value_type;
+ typedef csbl::vector<value_type> container_type;
+ typedef detail::future_when_all_vector_shared_state<value_type> factory_type;
+
+ if (first==last) return make_ready_future(container_type());
+
+ shared_ptr<factory_type >
+ h(new factory_type>(detail::input_iterator_tag_value, first,last));
+ return BOOST_THREAD_FUTURE<container_type>(h);
+ }
+
+//#if ! defined(BOOST_NO_CXX11_HDR_TUPLE)
+ BOOST_THREAD_FUTURE<csbl::tuple<> > when_all()
+ {
+ return make_ready_future(csbl::tuple<>());
+ }
+//#endif
+
+#if ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+ template< typename T0, typename ...T>
+ BOOST_THREAD_FUTURE<typename detail::when_type<T0, T...>::container_type>
+ when_all(BOOST_THREAD_RV_REF(T0) f, BOOST_THREAD_RV_REF(T) ... futures)
+ {
+ typedef typename detail::when_type<T0, T...>::container_type container_type;
+ typedef typename detail::when_type<T0, T...>::factory_all_type factory_type;
+
+ shared_ptr<factory_type>
+ h(new factory_type(detail::values_tag_value, boost::forward<T0>(f), boost::forward<T>(futures)...));
+ return BOOST_THREAD_FUTURE<container_type>(h);
+ }
+#endif
+
+ template< typename InputIterator>
+ typename boost::disable_if<is_future_type<InputIterator>,
+ BOOST_THREAD_FUTURE<csbl::vector<typename InputIterator::value_type> >
+ >::type
+ when_any(InputIterator first, InputIterator last)
+ {
+ typedef typename InputIterator::value_type value_type;
+ typedef csbl::vector<value_type> container_type;
+ typedef detail::future_when_any_vector_shared_state<value_type> factory_type;
+
+ if (first==last) return make_ready_future(container_type());
+
+ shared_ptr<factory_type >
+ h(new factory_type>(detail::input_iterator_tag_value, first,last));
+ return BOOST_THREAD_FUTURE<container_type>(h);
+ }
+
+//#if ! defined(BOOST_NO_CXX11_HDR_TUPLE)
+ BOOST_THREAD_FUTURE<csbl::tuple<> > when_any()
+ {
+ return make_ready_future(csbl::tuple<>());
+ }
+//#endif
+
+#if ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+ template< typename T0, typename ...T>
+ BOOST_THREAD_FUTURE<typename detail::when_type<T0, T...>::container_type> when_any(BOOST_THREAD_RV_REF(T0) f, BOOST_THREAD_RV_REF(T) ... futures)
+ {
+ typedef typename detail::when_type<T0, T...>::container_type container_type;
+ typedef typename detail::when_type<T0, T...>::factory_any_type factory_type;
+
+ shared_ptr<factory_type>
+ h(new factory_type(detail::values_tag_value, boost::forward<T0>(f), boost::forward<T>(futures)...));
+ return BOOST_THREAD_FUTURE<container_type>(h);
+ }
+#endif
+#endif // BOOST_THREAD_PROVIDES_FUTURE_WHEN_ALL_WHEN_ANY
}
#endif // BOOST_NO_EXCEPTION
Modified: branches/release/boost/thread/future_error_code.hpp
==============================================================================
--- branches/release/boost/thread/future_error_code.hpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/boost/thread/future_error_code.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -29,11 +29,11 @@
namespace system
{
template <>
- struct BOOST_SYMBOL_VISIBLE is_error_code_enum<future_errc> : public true_type {};
+ struct BOOST_SYMBOL_VISIBLE is_error_code_enum< ::boost::future_errc> : public true_type {};
#ifdef BOOST_NO_CXX11_SCOPED_ENUMS
template <>
- struct BOOST_SYMBOL_VISIBLE is_error_code_enum<future_errc::enum_type> : public true_type { };
+ struct BOOST_SYMBOL_VISIBLE is_error_code_enum< ::boost::future_errc::enum_type> : public true_type { };
#endif
} // system
@@ -53,7 +53,7 @@
error_condition
make_error_condition(future_errc e) BOOST_NOEXCEPT
{
- return error_condition(underlying_cast<int>(e), future_category());
+ return error_condition(underlying_cast<int>(e), boost::future_category());
}
} // system
} // boost
Modified: branches/release/boost/thread/lock_types.hpp
==============================================================================
--- branches/release/boost/thread/lock_types.hpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/boost/thread/lock_types.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -336,12 +336,12 @@
if (m == 0)
{
boost::throw_exception(
- boost::lock_error(system::errc::operation_not_permitted, "boost unique_lock has no mutex"));
+ boost::lock_error(static_cast<int>(system::errc::operation_not_permitted), "boost unique_lock has no mutex"));
}
if (owns_lock())
{
boost::throw_exception(
- boost::lock_error(system::errc::resource_deadlock_would_occur, "boost unique_lock owns already the mutex"));
+ boost::lock_error(static_cast<int>(system::errc::resource_deadlock_would_occur), "boost unique_lock owns already the mutex"));
}
m->lock();
is_locked = true;
@@ -351,12 +351,12 @@
if (m == 0)
{
boost::throw_exception(
- boost::lock_error(system::errc::operation_not_permitted, "boost unique_lock has no mutex"));
+ boost::lock_error(static_cast<int>(system::errc::operation_not_permitted), "boost unique_lock has no mutex"));
}
if (owns_lock())
{
boost::throw_exception(
- boost::lock_error(system::errc::resource_deadlock_would_occur, "boost unique_lock owns already the mutex"));
+ boost::lock_error(static_cast<int>(system::errc::resource_deadlock_would_occur), "boost unique_lock owns already the mutex"));
}
is_locked = m->try_lock();
return is_locked;
@@ -367,11 +367,11 @@
{
if(m==0)
{
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost unique_lock has no mutex"));
+ boost::throw_exception(boost::lock_error(static_cast<int>(system::errc::operation_not_permitted), "boost unique_lock has no mutex"));
}
if(owns_lock())
{
- boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost unique_lock owns already the mutex"));
+ boost::throw_exception(boost::lock_error(static_cast<int>(system::errc::resource_deadlock_would_occur), "boost unique_lock owns already the mutex"));
}
is_locked=m->timed_lock(relative_time);
return is_locked;
@@ -381,11 +381,11 @@
{
if(m==0)
{
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost unique_lock has no mutex"));
+ boost::throw_exception(boost::lock_error(static_cast<int>(system::errc::operation_not_permitted), "boost unique_lock has no mutex"));
}
if(owns_lock())
{
- boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost unique_lock owns already the mutex"));
+ boost::throw_exception(boost::lock_error(static_cast<int>(system::errc::resource_deadlock_would_occur), "boost unique_lock owns already the mutex"));
}
is_locked=m->timed_lock(absolute_time);
return is_locked;
@@ -394,11 +394,11 @@
{
if(m==0)
{
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost unique_lock has no mutex"));
+ boost::throw_exception(boost::lock_error(static_cast<int>(system::errc::operation_not_permitted), "boost unique_lock has no mutex"));
}
if(owns_lock())
{
- boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost unique_lock owns already the mutex"));
+ boost::throw_exception(boost::lock_error(static_cast<int>(system::errc::resource_deadlock_would_occur), "boost unique_lock owns already the mutex"));
}
is_locked=m->timed_lock(absolute_time);
return is_locked;
@@ -411,11 +411,11 @@
{
if(m==0)
{
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost unique_lock has no mutex"));
+ boost::throw_exception(boost::lock_error(static_cast<int>(system::errc::operation_not_permitted), "boost unique_lock has no mutex"));
}
if(owns_lock())
{
- boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost unique_lock owns already the mutex"));
+ boost::throw_exception(boost::lock_error(static_cast<int>(system::errc::resource_deadlock_would_occur), "boost unique_lock owns already the mutex"));
}
is_locked=m->try_lock_for(rel_time);
return is_locked;
@@ -425,11 +425,11 @@
{
if(m==0)
{
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost unique_lock has no mutex"));
+ boost::throw_exception(boost::lock_error(static_cast<int>(system::errc::operation_not_permitted), "boost unique_lock has no mutex"));
}
if(owns_lock())
{
- boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost unique_lock owns already the mutex"));
+ boost::throw_exception(boost::lock_error(static_cast<int>(system::errc::resource_deadlock_would_occur), "boost unique_lock owns already the mutex"));
}
is_locked=m->try_lock_until(abs_time);
return is_locked;
@@ -441,12 +441,12 @@
if (m == 0)
{
boost::throw_exception(
- boost::lock_error(system::errc::operation_not_permitted, "boost unique_lock has no mutex"));
+ boost::lock_error(static_cast<int>(system::errc::operation_not_permitted), "boost unique_lock has no mutex"));
}
if (!owns_lock())
{
boost::throw_exception(
- boost::lock_error(system::errc::operation_not_permitted, "boost unique_lock doesn't own the mutex"));
+ boost::lock_error(static_cast<int>(system::errc::operation_not_permitted), "boost unique_lock doesn't own the mutex"));
}
m->unlock();
is_locked = false;
@@ -636,11 +636,11 @@
{
if(m==0)
{
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex"));
+ boost::throw_exception(boost::lock_error(static_cast<int>(system::errc::operation_not_permitted), "boost shared_lock has no mutex"));
}
if(owns_lock())
{
- boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost shared_lock owns already the mutex"));
+ boost::throw_exception(boost::lock_error(static_cast<int>(system::errc::resource_deadlock_would_occur), "boost shared_lock owns already the mutex"));
}
m->lock_shared();
is_locked=true;
@@ -649,11 +649,11 @@
{
if(m==0)
{
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex"));
+ boost::throw_exception(boost::lock_error(static_cast<int>(system::errc::operation_not_permitted), "boost shared_lock has no mutex"));
}
if(owns_lock())
{
- boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost shared_lock owns already the mutex"));
+ boost::throw_exception(boost::lock_error(static_cast<int>(system::errc::resource_deadlock_would_occur), "boost shared_lock owns already the mutex"));
}
is_locked=m->try_lock_shared();
return is_locked;
@@ -663,11 +663,11 @@
{
if(m==0)
{
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex"));
+ boost::throw_exception(boost::lock_error(static_cast<int>(system::errc::operation_not_permitted), "boost shared_lock has no mutex"));
}
if(owns_lock())
{
- boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost shared_lock owns already the mutex"));
+ boost::throw_exception(boost::lock_error(static_cast<int>(system::errc::resource_deadlock_would_occur), "boost shared_lock owns already the mutex"));
}
is_locked=m->timed_lock_shared(target_time);
return is_locked;
@@ -677,11 +677,11 @@
{
if(m==0)
{
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex"));
+ boost::throw_exception(boost::lock_error(static_cast<int>(system::errc::operation_not_permitted), "boost shared_lock has no mutex"));
}
if(owns_lock())
{
- boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost shared_lock owns already the mutex"));
+ boost::throw_exception(boost::lock_error(static_cast<int>(system::errc::resource_deadlock_would_occur), "boost shared_lock owns already the mutex"));
}
is_locked=m->timed_lock_shared(target_time);
return is_locked;
@@ -693,11 +693,11 @@
{
if(m==0)
{
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex"));
+ boost::throw_exception(boost::lock_error(static_cast<int>(system::errc::operation_not_permitted), "boost shared_lock has no mutex"));
}
if(owns_lock())
{
- boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost shared_lock owns already the mutex"));
+ boost::throw_exception(boost::lock_error(static_cast<int>(system::errc::resource_deadlock_would_occur), "boost shared_lock owns already the mutex"));
}
is_locked=m->try_lock_shared_for(rel_time);
return is_locked;
@@ -707,11 +707,11 @@
{
if(m==0)
{
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex"));
+ boost::throw_exception(boost::lock_error(static_cast<int>(system::errc::operation_not_permitted), "boost shared_lock has no mutex"));
}
if(owns_lock())
{
- boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost shared_lock owns already the mutex"));
+ boost::throw_exception(boost::lock_error(static_cast<int>(system::errc::resource_deadlock_would_occur), "boost shared_lock owns already the mutex"));
}
is_locked=m->try_lock_shared_until(abs_time);
return is_locked;
@@ -721,11 +721,11 @@
{
if(m==0)
{
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex"));
+ boost::throw_exception(boost::lock_error(static_cast<int>(system::errc::operation_not_permitted), "boost shared_lock has no mutex"));
}
if(!owns_lock())
{
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock doesn't own the mutex"));
+ boost::throw_exception(boost::lock_error(static_cast<int>(system::errc::operation_not_permitted), "boost shared_lock doesn't own the mutex"));
}
m->unlock_shared();
is_locked=false;
@@ -934,12 +934,12 @@
if (m == 0)
{
boost::throw_exception(
- boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex"));
+ boost::lock_error(static_cast<int>(system::errc::operation_not_permitted), "boost shared_lock has no mutex"));
}
if (owns_lock())
{
boost::throw_exception(
- boost::lock_error(system::errc::resource_deadlock_would_occur, "boost upgrade_lock owns already the mutex"));
+ boost::lock_error(static_cast<int>(system::errc::resource_deadlock_would_occur), "boost upgrade_lock owns already the mutex"));
}
m->lock_upgrade();
is_locked = true;
@@ -949,12 +949,12 @@
if (m == 0)
{
boost::throw_exception(
- boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex"));
+ boost::lock_error(static_cast<int>(system::errc::operation_not_permitted), "boost shared_lock has no mutex"));
}
if (owns_lock())
{
boost::throw_exception(
- boost::lock_error(system::errc::resource_deadlock_would_occur, "boost upgrade_lock owns already the mutex"));
+ boost::lock_error(static_cast<int>(system::errc::resource_deadlock_would_occur), "boost upgrade_lock owns already the mutex"));
}
is_locked = m->try_lock_upgrade();
return is_locked;
@@ -964,12 +964,12 @@
if (m == 0)
{
boost::throw_exception(
- boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex"));
+ boost::lock_error(static_cast<int>(system::errc::operation_not_permitted), "boost shared_lock has no mutex"));
}
if (!owns_lock())
{
boost::throw_exception(
- boost::lock_error(system::errc::operation_not_permitted, "boost upgrade_lock doesn't own the mutex"));
+ boost::lock_error(static_cast<int>(system::errc::operation_not_permitted), "boost upgrade_lock doesn't own the mutex"));
}
m->unlock_upgrade();
is_locked = false;
@@ -980,11 +980,11 @@
{
if(m==0)
{
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex"));
+ boost::throw_exception(boost::lock_error(static_cast<int>(system::errc::operation_not_permitted), "boost shared_lock has no mutex"));
}
if(owns_lock())
{
- boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost shared_lock owns already the mutex"));
+ boost::throw_exception(boost::lock_error(static_cast<int>(system::errc::resource_deadlock_would_occur), "boost shared_lock owns already the mutex"));
}
is_locked=m->try_lock_upgrade_for(rel_time);
return is_locked;
@@ -994,11 +994,11 @@
{
if(m==0)
{
- boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex"));
+ boost::throw_exception(boost::lock_error(static_cast<int>(system::errc::operation_not_permitted), "boost shared_lock has no mutex"));
}
if(owns_lock())
{
- boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost shared_lock owns already the mutex"));
+ boost::throw_exception(boost::lock_error(static_cast<int>(system::errc::resource_deadlock_would_occur), "boost shared_lock owns already the mutex"));
}
is_locked=m->try_lock_upgrade_until(abs_time);
return is_locked;
Copied and modified: branches/release/boost/thread/ostream_buffer.hpp (from r85733, trunk/boost/thread/ostream_buffer.hpp)
==============================================================================
--- trunk/boost/thread/ostream_buffer.hpp Tue Sep 17 17:01:05 2013 (r85733, copy source)
+++ branches/release/boost/thread/ostream_buffer.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -21,13 +21,23 @@
{
public:
typedef std::basic_ostringstream<typename OStream::char_type, typename OStream::traits_type> stream_type;
- ostream_buffer(OStream& os) : os_(os) {}
- ~ostream_buffer() { os_ << o_str_.str(); }
- stream_type& stream() { return o_str_; }
+ ostream_buffer(OStream& os) :
+ os_(os)
+ {
+ }
+ ~ostream_buffer()
+ {
+ os_ << o_str_.str();
+ }
+ stream_type& stream()
+ {
+ return o_str_;
+ }
private:
OStream& os_;
stream_type o_str_;
};
+
}
#include <boost/config/abi_suffix.hpp>
Modified: branches/release/boost/thread/scoped_thread.hpp
==============================================================================
--- branches/release/boost/thread/scoped_thread.hpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/boost/thread/scoped_thread.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -177,7 +177,7 @@
* Move constructor.
*/
scoped_thread(BOOST_RV_REF(scoped_thread) x) BOOST_NOEXCEPT :
- t_(boost::move(x.t_))
+ t_(boost::move(BOOST_THREAD_RV(x).t_))
{}
/**
@@ -197,7 +197,7 @@
*/
scoped_thread& operator=(BOOST_RV_REF(scoped_thread) x)
{
- t_ = boost::move(x.t_);
+ t_ = boost::move(BOOST_THREAD_RV(x).t_);
return *this;
}
@@ -261,11 +261,17 @@
}
#endif
- static unsigned hardware_concurrency()BOOST_NOEXCEPT
+ static unsigned hardware_concurrency() BOOST_NOEXCEPT
{
return thread::hardware_concurrency();
}
+#ifdef BOOST_THREAD_PROVIDES_PHYSICAL_CONCURRENCY
+ static unsigned physical_concurrency() BOOST_NOEXCEPT
+ {
+ return thread::physical_concurrency();
+ }
+#endif
};
/**
Modified: branches/release/boost/thread/sync_bounded_queue.hpp
==============================================================================
--- branches/release/boost/thread/sync_bounded_queue.hpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/boost/thread/sync_bounded_queue.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -16,9 +16,10 @@
#include <boost/thread/mutex.hpp>
#include <boost/thread/detail/move.hpp>
#include <boost/throw_exception.hpp>
+#ifndef BOOST_THREAD_QUEUE_DEPRECATE_OLD
#include <boost/smart_ptr/shared_ptr.hpp>
#include <boost/smart_ptr/make_shared.hpp>
-
+#endif
#include <boost/config/abi_prefix.hpp>
namespace boost
@@ -28,10 +29,14 @@
{ success = 0, empty, full, closed, busy }
BOOST_SCOPED_ENUM_DECLARE_END(queue_op_status)
+#ifndef BOOST_THREAD_QUEUE_DEPRECATE_OLD
struct no_block_tag{};
BOOST_CONSTEXPR_OR_CONST no_block_tag no_block = {};
+#endif
- struct sync_queue_is_closed : std::exception {};
+ struct sync_queue_is_closed : std::exception
+ {
+ };
template <typename ValueType>
class sync_bounded_queue
@@ -57,14 +62,23 @@
// Modifiers
inline void close();
+#ifndef BOOST_THREAD_QUEUE_DEPRECATE_OLD
inline void push(const value_type& x);
inline void push(BOOST_THREAD_RV_REF(value_type) x);
inline bool try_push(const value_type& x);
inline bool try_push(BOOST_THREAD_RV_REF(value_type) x);
inline bool try_push(no_block_tag, const value_type& x);
inline bool try_push(no_block_tag, BOOST_THREAD_RV_REF(value_type) x);
+#endif
+ inline void push_back(const value_type& x);
+ inline void push_back(BOOST_THREAD_RV_REF(value_type) x);
+ inline queue_op_status try_push_back(const value_type& x);
+ inline queue_op_status try_push_back(BOOST_THREAD_RV_REF(value_type) x);
+ inline queue_op_status nonblocking_push_back(const value_type& x);
+ inline queue_op_status nonblocking_push_back(BOOST_THREAD_RV_REF(value_type) x);
// Observers/Modifiers
+#ifndef BOOST_THREAD_QUEUE_DEPRECATE_OLD
inline void pull(value_type&);
inline void pull(ValueType& elem, bool & closed);
// enable_if is_nothrow_copy_movable<value_type>
@@ -73,6 +87,12 @@
inline bool try_pull(value_type&);
inline bool try_pull(no_block_tag,value_type&);
inline shared_ptr<ValueType> try_pull();
+#endif
+ inline void pull_front(value_type&);
+ // enable_if is_nothrow_copy_movable<value_type>
+ inline value_type pull_front();
+ inline queue_op_status try_pull_front(value_type&);
+ inline queue_op_status nonblocking_pull_front(value_type&);
private:
mutable mutex mtx_;
@@ -118,11 +138,17 @@
}
inline void throw_if_closed(unique_lock<mutex>&);
+ inline bool closed(unique_lock<mutex>&) const;
+#ifndef BOOST_THREAD_QUEUE_DEPRECATE_OLD
inline bool try_pull(value_type& x, unique_lock<mutex>& lk);
+ inline shared_ptr<value_type> try_pull(unique_lock<mutex>& lk);
inline bool try_push(const value_type& x, unique_lock<mutex>& lk);
inline bool try_push(BOOST_THREAD_RV_REF(value_type) x, unique_lock<mutex>& lk);
- inline shared_ptr<value_type> try_pull(unique_lock<mutex>& lk);
+#endif
+ inline queue_op_status try_pull_front(value_type& x, unique_lock<mutex>& lk);
+ inline queue_op_status try_push_back(const value_type& x, unique_lock<mutex>& lk);
+ inline queue_op_status try_push_back(BOOST_THREAD_RV_REF(value_type) x, unique_lock<mutex>& lk);
inline void wait_until_not_empty(unique_lock<mutex>& lk);
inline void wait_until_not_empty(unique_lock<mutex>& lk, bool&);
@@ -149,12 +175,20 @@
}
}
+#ifndef BOOST_THREAD_QUEUE_DEPRECATE_OLD
inline void pull(value_type& elem, unique_lock<mutex>& lk)
{
elem = boost::move(data_[out_]);
out_ = inc(out_);
notify_not_full_if_needed(lk);
}
+ inline value_type pull(unique_lock<mutex>& lk)
+ {
+ value_type elem = boost::move(data_[out_]);
+ out_ = inc(out_);
+ notify_not_full_if_needed(lk);
+ return boost::move(elem);
+ }
inline boost::shared_ptr<value_type> ptr_pull(unique_lock<mutex>& lk)
{
shared_ptr<value_type> res = make_shared<value_type>(boost::move(data_[out_]));
@@ -162,6 +196,20 @@
notify_not_full_if_needed(lk);
return res;
}
+#endif
+ inline void pull_front(value_type& elem, unique_lock<mutex>& lk)
+ {
+ elem = boost::move(data_[out_]);
+ out_ = inc(out_);
+ notify_not_full_if_needed(lk);
+ }
+ inline value_type pull_front(unique_lock<mutex>& lk)
+ {
+ value_type elem = boost::move(data_[out_]);
+ out_ = inc(out_);
+ notify_not_full_if_needed(lk);
+ return boost::move(elem);
+ }
inline void set_in(size_type in, unique_lock<mutex>& lk)
{
@@ -239,6 +287,11 @@
lock_guard<mutex> lk(mtx_);
return closed_;
}
+ template <typename ValueType>
+ bool sync_bounded_queue<ValueType>::closed(unique_lock<mutex>& ) const
+ {
+ return closed_;
+ }
template <typename ValueType>
bool sync_bounded_queue<ValueType>::empty() const
@@ -267,7 +320,7 @@
return size(lk);
}
-
+#ifndef BOOST_THREAD_QUEUE_DEPRECATE_OLD
template <typename ValueType>
bool sync_bounded_queue<ValueType>::try_pull(ValueType& elem, unique_lock<mutex>& lk)
{
@@ -289,7 +342,6 @@
}
return ptr_pull(lk);
}
-
template <typename ValueType>
bool sync_bounded_queue<ValueType>::try_pull(ValueType& elem)
{
@@ -304,8 +356,29 @@
throw;
}
}
+#endif
+
+ template <typename ValueType>
+ queue_op_status sync_bounded_queue<ValueType>::try_pull_front(ValueType& elem, unique_lock<mutex>& lk)
+ {
+ if (empty(lk))
+ {
+ if (closed(lk)) return queue_op_status::closed;
+ return queue_op_status::empty;
+ }
+ pull_front(elem, lk);
+ return queue_op_status::success;
+ }
template <typename ValueType>
+ queue_op_status sync_bounded_queue<ValueType>::try_pull_front(ValueType& elem)
+ {
+ unique_lock<mutex> lk(mtx_);
+ return try_pull_front(elem, lk);
+ }
+
+#ifndef BOOST_THREAD_QUEUE_DEPRECATE_OLD
+ template <typename ValueType>
bool sync_bounded_queue<ValueType>::try_pull(no_block_tag,ValueType& elem)
{
try
@@ -337,6 +410,18 @@
throw;
}
}
+#endif
+
+ template <typename ValueType>
+ queue_op_status sync_bounded_queue<ValueType>::nonblocking_pull_front(ValueType& elem)
+ {
+ unique_lock<mutex> lk(mtx_, try_to_lock);
+ if (!lk.owns_lock())
+ {
+ return queue_op_status::busy;
+ }
+ return try_pull_front(elem, lk);
+ }
template <typename ValueType>
void sync_bounded_queue<ValueType>::throw_if_closed(unique_lock<mutex>&)
@@ -370,6 +455,7 @@
}
}
+#ifndef BOOST_THREAD_QUEUE_DEPRECATE_OLD
template <typename ValueType>
void sync_bounded_queue<ValueType>::pull(ValueType& elem)
{
@@ -401,16 +487,15 @@
throw;
}
}
-
// enable if ValueType is nothrow movable
template <typename ValueType>
ValueType sync_bounded_queue<ValueType>::pull()
{
try
{
- value_type elem;
- pull(elem);
- return boost::move(elem);
+ unique_lock<mutex> lk(mtx_);
+ wait_until_not_empty(lk);
+ return pull(lk);
}
catch (...)
{
@@ -434,6 +519,42 @@
}
}
+#endif
+
+ template <typename ValueType>
+ void sync_bounded_queue<ValueType>::pull_front(ValueType& elem)
+ {
+ try
+ {
+ unique_lock<mutex> lk(mtx_);
+ wait_until_not_empty(lk);
+ pull_front(elem, lk);
+ }
+ catch (...)
+ {
+ close();
+ throw;
+ }
+ }
+
+ // enable if ValueType is nothrow movable
+ template <typename ValueType>
+ ValueType sync_bounded_queue<ValueType>::pull_front()
+ {
+ try
+ {
+ unique_lock<mutex> lk(mtx_);
+ wait_until_not_empty(lk);
+ return pull_front(lk);
+ }
+ catch (...)
+ {
+ close();
+ throw;
+ }
+ }
+
+#ifndef BOOST_THREAD_QUEUE_DEPRECATE_OLD
template <typename ValueType>
bool sync_bounded_queue<ValueType>::try_push(const ValueType& elem, unique_lock<mutex>& lk)
{
@@ -446,7 +567,6 @@
push_at(elem, in_p_1, lk);
return true;
}
-
template <typename ValueType>
bool sync_bounded_queue<ValueType>::try_push(const ValueType& elem)
{
@@ -462,6 +582,29 @@
}
}
+#endif
+
+ template <typename ValueType>
+ queue_op_status sync_bounded_queue<ValueType>::try_push_back(const ValueType& elem, unique_lock<mutex>& lk)
+ {
+ if (closed(lk)) return queue_op_status::closed;
+ size_type in_p_1 = inc(in_);
+ if (in_p_1 == out_) // full()
+ {
+ return queue_op_status::full;
+ }
+ push_at(elem, in_p_1, lk);
+ return queue_op_status::success;
+ }
+
+ template <typename ValueType>
+ queue_op_status sync_bounded_queue<ValueType>::try_push_back(const ValueType& elem)
+ {
+ unique_lock<mutex> lk(mtx_);
+ return try_push_back(elem, lk);
+ }
+
+#ifndef BOOST_THREAD_QUEUE_DEPRECATE_OLD
template <typename ValueType>
bool sync_bounded_queue<ValueType>::try_push(no_block_tag, const ValueType& elem)
{
@@ -477,7 +620,15 @@
throw;
}
}
+#endif
+ template <typename ValueType>
+ queue_op_status sync_bounded_queue<ValueType>::nonblocking_push_back(const ValueType& elem)
+ {
+ unique_lock<mutex> lk(mtx_, try_to_lock);
+ if (!lk.owns_lock()) return queue_op_status::busy;
+ return try_push_back(elem, lk);
+ }
template <typename ValueType>
typename sync_bounded_queue<ValueType>::size_type sync_bounded_queue<ValueType>::wait_until_not_full(unique_lock<mutex>& lk)
@@ -495,6 +646,7 @@
}
}
+#ifndef BOOST_THREAD_QUEUE_DEPRECATE_OLD
template <typename ValueType>
void sync_bounded_queue<ValueType>::push(const ValueType& elem)
{
@@ -509,7 +661,23 @@
throw;
}
}
+#endif
+ template <typename ValueType>
+ void sync_bounded_queue<ValueType>::push_back(const ValueType& elem)
+ {
+ try
+ {
+ unique_lock<mutex> lk(mtx_);
+ push_at(elem, wait_until_not_full(lk), lk);
+ }
+ catch (...)
+ {
+ close();
+ throw;
+ }
+ }
+#ifndef BOOST_THREAD_QUEUE_DEPRECATE_OLD
template <typename ValueType>
bool sync_bounded_queue<ValueType>::try_push(BOOST_THREAD_RV_REF(ValueType) elem, unique_lock<mutex>& lk)
{
@@ -529,7 +697,7 @@
try
{
unique_lock<mutex> lk(mtx_);
- return try_push(elem, lk);
+ return try_push(boost::move(elem), lk);
}
catch (...)
{
@@ -537,7 +705,28 @@
throw;
}
}
+#endif
+
+ template <typename ValueType>
+ queue_op_status sync_bounded_queue<ValueType>::try_push_back(BOOST_THREAD_RV_REF(ValueType) elem, unique_lock<mutex>& lk)
+ {
+ if (closed(lk)) return queue_op_status::closed;
+ size_type in_p_1 = inc(in_);
+ if (in_p_1 == out_) // full()
+ {
+ return queue_op_status::full;
+ }
+ push_at(boost::move(elem), in_p_1, lk);
+ return queue_op_status::success;
+ }
+ template <typename ValueType>
+ queue_op_status sync_bounded_queue<ValueType>::try_push_back(BOOST_THREAD_RV_REF(ValueType) elem)
+ {
+ unique_lock<mutex> lk(mtx_);
+ return try_push_back(boost::move(elem), lk);
+ }
+#ifndef BOOST_THREAD_QUEUE_DEPRECATE_OLD
template <typename ValueType>
bool sync_bounded_queue<ValueType>::try_push(no_block_tag, BOOST_THREAD_RV_REF(ValueType) elem)
{
@@ -548,7 +737,7 @@
{
return false;
}
- return try_push(elem, lk);
+ return try_push(boost::move(elem), lk);
}
catch (...)
{
@@ -556,14 +745,41 @@
throw;
}
}
+#endif
+ template <typename ValueType>
+ queue_op_status sync_bounded_queue<ValueType>::nonblocking_push_back(BOOST_THREAD_RV_REF(ValueType) elem)
+ {
+ unique_lock<mutex> lk(mtx_, try_to_lock);
+ if (!lk.owns_lock())
+ {
+ return queue_op_status::busy;
+ }
+ return try_push_back(boost::move(elem), lk);
+ }
+#ifndef BOOST_THREAD_QUEUE_DEPRECATE_OLD
template <typename ValueType>
void sync_bounded_queue<ValueType>::push(BOOST_THREAD_RV_REF(ValueType) elem)
{
try
{
unique_lock<mutex> lk(mtx_);
- push_at(elem, wait_until_not_full(lk), lk);
+ push_at(boost::move(elem), wait_until_not_full(lk), lk);
+ }
+ catch (...)
+ {
+ close();
+ throw;
+ }
+ }
+#endif
+ template <typename ValueType>
+ void sync_bounded_queue<ValueType>::push_back(BOOST_THREAD_RV_REF(ValueType) elem)
+ {
+ try
+ {
+ unique_lock<mutex> lk(mtx_);
+ push_at(boost::move(elem), wait_until_not_full(lk), lk);
}
catch (...)
{
@@ -575,21 +791,21 @@
template <typename ValueType>
sync_bounded_queue<ValueType>& operator<<(sync_bounded_queue<ValueType>& sbq, BOOST_THREAD_RV_REF(ValueType) elem)
{
- sbq.push(boost::forward<ValueType>(elem));
+ sbq.push_back(boost::move(elem));
return sbq;
}
template <typename ValueType>
sync_bounded_queue<ValueType>& operator<<(sync_bounded_queue<ValueType>& sbq, ValueType const&elem)
{
- sbq.push(elem);
+ sbq.push_back(elem);
return sbq;
}
template <typename ValueType>
sync_bounded_queue<ValueType>& operator>>(sync_bounded_queue<ValueType>& sbq, ValueType &elem)
{
- sbq.pull(elem);
+ sbq.pull_front(elem);
return sbq;
}
Modified: branches/release/boost/thread/sync_queue.hpp
==============================================================================
--- branches/release/boost/thread/sync_queue.hpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/boost/thread/sync_queue.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -20,19 +20,19 @@
#include <boost/smart_ptr/make_shared.hpp>
#include <boost/thread/sync_bounded_queue.hpp>
-#include <boost/container/deque.hpp>
+#include <boost/thread/csbl/deque.hpp>
#include <boost/config/abi_prefix.hpp>
namespace boost
{
-
template <typename ValueType>
class sync_queue
{
public:
typedef ValueType value_type;
+ typedef csbl::deque<ValueType> underlying_queue_type;
typedef std::size_t size_type;
// Constructors/Assignment/Destructors
@@ -51,28 +51,53 @@
// Modifiers
inline void close();
+#ifndef BOOST_THREAD_QUEUE_DEPRECATE_OLD
inline void push(const value_type& x);
- inline void push(BOOST_THREAD_RV_REF(value_type) x);
inline bool try_push(const value_type& x);
- inline bool try_push(BOOST_THREAD_RV_REF(value_type) x);
inline bool try_push(no_block_tag, const value_type& x);
+ inline void push(BOOST_THREAD_RV_REF(value_type) x);
+ inline bool try_push(BOOST_THREAD_RV_REF(value_type) x);
inline bool try_push(no_block_tag, BOOST_THREAD_RV_REF(value_type) x);
+#endif
+ inline void push_back(const value_type& x);
+ inline queue_op_status try_push_back(const value_type& x);
+ inline queue_op_status nonblocking_push_back(const value_type& x);
+ inline void push_back(BOOST_THREAD_RV_REF(value_type) x);
+ inline queue_op_status try_push_back(BOOST_THREAD_RV_REF(value_type) x);
+ inline queue_op_status nonblocking_push_back(BOOST_THREAD_RV_REF(value_type) x);
+
// Observers/Modifiers
+#ifndef BOOST_THREAD_QUEUE_DEPRECATE_OLD
inline void pull(value_type&);
inline void pull(ValueType& elem, bool & closed);
// enable_if is_nothrow_copy_movable<value_type>
inline value_type pull();
inline shared_ptr<ValueType> ptr_pull();
+#endif
+ inline void pull_front(value_type&);
+ inline void pull_front(ValueType& elem, bool & closed);
+ // enable_if is_nothrow_copy_movable<value_type>
+ inline value_type pull_front();
+
+#ifndef BOOST_THREAD_QUEUE_DEPRECATE_OLD
inline bool try_pull(value_type&);
inline bool try_pull(no_block_tag,value_type&);
inline shared_ptr<ValueType> try_pull();
+#endif
+ inline queue_op_status try_pull_front(value_type&);
+ inline queue_op_status nonblocking_pull_front(value_type&);
+
+ inline underlying_queue_type underlying_queue() {
+ lock_guard<mutex> lk(mtx_);
+ return boost::move(data_);
+ }
private:
mutable mutex mtx_;
condition_variable not_empty_;
size_type waiting_empty_;
- boost::container::deque<ValueType> data_;
+ underlying_queue_type data_;
bool closed_;
inline bool empty(unique_lock<mutex>& ) const BOOST_NOEXCEPT
@@ -90,11 +115,17 @@
}
inline void throw_if_closed(unique_lock<mutex>&);
+ inline bool closed(unique_lock<mutex>& lk) const;
+#ifndef BOOST_THREAD_QUEUE_DEPRECATE_OLD
inline bool try_pull(value_type& x, unique_lock<mutex>& lk);
inline bool try_push(const value_type& x, unique_lock<mutex>& lk);
inline bool try_push(BOOST_THREAD_RV_REF(value_type) x, unique_lock<mutex>& lk);
inline shared_ptr<value_type> try_pull(unique_lock<mutex>& lk);
+#endif
+ inline queue_op_status try_pull_front(value_type& x, unique_lock<mutex>& lk);
+ inline queue_op_status try_push_back(const value_type& x, unique_lock<mutex>& lk);
+ inline queue_op_status try_push_back(BOOST_THREAD_RV_REF(value_type) x, unique_lock<mutex>& lk);
inline void wait_until_not_empty(unique_lock<mutex>& lk);
inline void wait_until_not_empty(unique_lock<mutex>& lk, bool&);
@@ -109,18 +140,38 @@
}
}
+#ifndef BOOST_THREAD_QUEUE_DEPRECATE_OLD
inline void pull(value_type& elem, unique_lock<mutex>& )
{
elem = boost::move(data_.front());
data_.pop_front();
}
+ inline value_type pull(unique_lock<mutex>& )
+ {
+ value_type e = boost::move(data_.front());
+ data_.pop_front();
+ return boost::move(e);
+ }
inline boost::shared_ptr<value_type> ptr_pull(unique_lock<mutex>& )
{
shared_ptr<value_type> res = make_shared<value_type>(boost::move(data_.front()));
data_.pop_front();
return res;
}
+#endif
+ inline void pull_front(value_type& elem, unique_lock<mutex>& )
+ {
+ elem = boost::move(data_.front());
+ data_.pop_front();
+ }
+ inline value_type pull_front(unique_lock<mutex>& )
+ {
+ value_type e = boost::move(data_.front());
+ data_.pop_front();
+ return boost::move(e);
+ }
+#ifndef BOOST_THREAD_QUEUE_DEPRECATE_OLD
inline void push(const value_type& elem, unique_lock<mutex>& lk)
{
data_.push_back(elem);
@@ -129,7 +180,19 @@
inline void push(BOOST_THREAD_RV_REF(value_type) elem, unique_lock<mutex>& lk)
{
- data_.push(boost::move(elem));
+ data_.push_back(boost::move(elem));
+ notify_not_empty_if_needed(lk);
+ }
+#endif
+ inline void push_back(const value_type& elem, unique_lock<mutex>& lk)
+ {
+ data_.push_back(elem);
+ notify_not_empty_if_needed(lk);
+ }
+
+ inline void push_back(BOOST_THREAD_RV_REF(value_type) elem, unique_lock<mutex>& lk)
+ {
+ data_.push_back(boost::move(elem));
notify_not_empty_if_needed(lk);
}
};
@@ -184,6 +247,11 @@
lock_guard<mutex> lk(mtx_);
return closed_;
}
+ template <typename ValueType>
+ bool sync_queue<ValueType>::closed(unique_lock<mutex>&) const
+ {
+ return closed_;
+ }
template <typename ValueType>
bool sync_queue<ValueType>::empty() const
@@ -205,6 +273,7 @@
}
+#ifndef BOOST_THREAD_QUEUE_DEPRECATE_OLD
template <typename ValueType>
bool sync_queue<ValueType>::try_pull(ValueType& elem, unique_lock<mutex>& lk)
{
@@ -226,7 +295,20 @@
}
return ptr_pull(lk);
}
+#endif
+ template <typename ValueType>
+ queue_op_status sync_queue<ValueType>::try_pull_front(ValueType& elem, unique_lock<mutex>& lk)
+ {
+ if (empty(lk))
+ {
+ if (closed(lk)) return queue_op_status::closed;
+ return queue_op_status::empty;
+ }
+ pull_front(elem, lk);
+ return queue_op_status::success;
+ }
+#ifndef BOOST_THREAD_QUEUE_DEPRECATE_OLD
template <typename ValueType>
bool sync_queue<ValueType>::try_pull(ValueType& elem)
{
@@ -241,7 +323,15 @@
throw;
}
}
+#endif
+ template <typename ValueType>
+ queue_op_status sync_queue<ValueType>::try_pull_front(ValueType& elem)
+ {
+ unique_lock<mutex> lk(mtx_);
+ return try_pull_front(elem, lk);
+ }
+#ifndef BOOST_THREAD_QUEUE_DEPRECATE_OLD
template <typename ValueType>
bool sync_queue<ValueType>::try_pull(no_block_tag,ValueType& elem)
{
@@ -274,6 +364,17 @@
throw;
}
}
+#endif
+ template <typename ValueType>
+ queue_op_status sync_queue<ValueType>::nonblocking_pull_front(ValueType& elem)
+ {
+ unique_lock<mutex> lk(mtx_, try_to_lock);
+ if (!lk.owns_lock())
+ {
+ return queue_op_status::busy;
+ }
+ return try_pull_front(elem, lk);
+ }
template <typename ValueType>
void sync_queue<ValueType>::throw_if_closed(unique_lock<mutex>&)
@@ -308,6 +409,7 @@
closed=false;
}
+#ifndef BOOST_THREAD_QUEUE_DEPRECATE_OLD
template <typename ValueType>
void sync_queue<ValueType>::pull(ValueType& elem)
{
@@ -346,9 +448,9 @@
{
try
{
- value_type elem;
- pull(elem);
- return boost::move(elem);
+ unique_lock<mutex> lk(mtx_);
+ wait_until_not_empty(lk);
+ return pull(lk);
}
catch (...)
{
@@ -371,7 +473,42 @@
throw;
}
}
+#endif
+
+ template <typename ValueType>
+ void sync_queue<ValueType>::pull_front(ValueType& elem)
+ {
+ try
+ {
+ unique_lock<mutex> lk(mtx_);
+ wait_until_not_empty(lk);
+ pull_front(elem, lk);
+ }
+ catch (...)
+ {
+ close();
+ throw;
+ }
+ }
+
+ // enable if ValueType is nothrow movable
+ template <typename ValueType>
+ ValueType sync_queue<ValueType>::pull_front()
+ {
+ try
+ {
+ unique_lock<mutex> lk(mtx_);
+ wait_until_not_empty(lk);
+ return pull_front(lk);
+ }
+ catch (...)
+ {
+ close();
+ throw;
+ }
+ }
+#ifndef BOOST_THREAD_QUEUE_DEPRECATE_OLD
template <typename ValueType>
bool sync_queue<ValueType>::try_push(const ValueType& elem, unique_lock<mutex>& lk)
{
@@ -394,7 +531,24 @@
throw;
}
}
+#endif
+
+ template <typename ValueType>
+ queue_op_status sync_queue<ValueType>::try_push_back(const ValueType& elem, unique_lock<mutex>& lk)
+ {
+ if (closed(lk)) return queue_op_status::closed;
+ push_back(elem, lk);
+ return queue_op_status::success;
+ }
+
+ template <typename ValueType>
+ queue_op_status sync_queue<ValueType>::try_push_back(const ValueType& elem)
+ {
+ unique_lock<mutex> lk(mtx_);
+ return try_push_back(elem, lk);
+ }
+#ifndef BOOST_THREAD_QUEUE_DEPRECATE_OLD
template <typename ValueType>
bool sync_queue<ValueType>::try_push(no_block_tag, const ValueType& elem)
{
@@ -410,7 +564,16 @@
throw;
}
}
+#endif
+ template <typename ValueType>
+ queue_op_status sync_queue<ValueType>::nonblocking_push_back(const ValueType& elem)
+ {
+ unique_lock<mutex> lk(mtx_, try_to_lock);
+ if (!lk.owns_lock()) return queue_op_status::busy;
+ return try_push(elem, lk);
+ }
+#ifndef BOOST_THREAD_QUEUE_DEPRECATE_OLD
template <typename ValueType>
void sync_queue<ValueType>::push(const ValueType& elem)
{
@@ -426,12 +589,30 @@
throw;
}
}
+#endif
template <typename ValueType>
+ void sync_queue<ValueType>::push_back(const ValueType& elem)
+ {
+ try
+ {
+ unique_lock<mutex> lk(mtx_);
+ throw_if_closed(lk);
+ push_back(elem, lk);
+ }
+ catch (...)
+ {
+ close();
+ throw;
+ }
+ }
+
+#ifndef BOOST_THREAD_QUEUE_DEPRECATE_OLD
+ template <typename ValueType>
bool sync_queue<ValueType>::try_push(BOOST_THREAD_RV_REF(ValueType) elem, unique_lock<mutex>& lk)
{
throw_if_closed(lk);
- push(boost::forward<ValueType>(elem), lk);
+ push(boost::move(elem), lk);
return true;
}
@@ -441,7 +622,7 @@
try
{
unique_lock<mutex> lk(mtx_);
- return try_push(elem, lk);
+ return try_push(boost::move(elem), lk);
}
catch (...)
{
@@ -449,8 +630,25 @@
throw;
}
}
+#endif
+
+ template <typename ValueType>
+ queue_op_status sync_queue<ValueType>::try_push_back(BOOST_THREAD_RV_REF(ValueType) elem, unique_lock<mutex>& lk)
+ {
+ if (closed(lk)) return queue_op_status::closed;
+ push_back(boost::move(elem), lk);
+ return queue_op_status::success;
+ }
template <typename ValueType>
+ queue_op_status sync_queue<ValueType>::try_push_back(BOOST_THREAD_RV_REF(ValueType) elem)
+ {
+ unique_lock<mutex> lk(mtx_);
+ return try_push_back(boost::move(elem), lk);
+ }
+
+#ifndef BOOST_THREAD_QUEUE_DEPRECATE_OLD
+ template <typename ValueType>
bool sync_queue<ValueType>::try_push(no_block_tag, BOOST_THREAD_RV_REF(ValueType) elem)
{
try
@@ -460,7 +658,7 @@
{
return false;
}
- return try_push(elem, lk);
+ return try_push(boost::move(elem), lk);
}
catch (...)
{
@@ -468,15 +666,45 @@
throw;
}
}
+#endif
template <typename ValueType>
+ queue_op_status sync_queue<ValueType>::nonblocking_push_back(BOOST_THREAD_RV_REF(ValueType) elem)
+ {
+ unique_lock<mutex> lk(mtx_, try_to_lock);
+ if (!lk.owns_lock())
+ {
+ return queue_op_status::busy;
+ }
+ return try_push_back(boost::move(elem), lk);
+ }
+
+#ifndef BOOST_THREAD_QUEUE_DEPRECATE_OLD
+ template <typename ValueType>
void sync_queue<ValueType>::push(BOOST_THREAD_RV_REF(ValueType) elem)
{
try
{
unique_lock<mutex> lk(mtx_);
throw_if_closed(lk);
- push(elem, lk);
+ push(boost::move(elem), lk);
+ }
+ catch (...)
+ {
+ close();
+ throw;
+ }
+ }
+#endif
+
+ template <typename ValueType>
+ void sync_queue<ValueType>::push_back(BOOST_THREAD_RV_REF(ValueType) elem)
+ {
+ try
+ {
+ unique_lock<mutex> lk(mtx_);
+ throw_if_closed(lk);
+ push_back(boost::move(elem), lk);
}
catch (...)
{
@@ -488,21 +716,21 @@
template <typename ValueType>
sync_queue<ValueType>& operator<<(sync_queue<ValueType>& sbq, BOOST_THREAD_RV_REF(ValueType) elem)
{
- sbq.push(boost::forward<ValueType>(elem));
+ sbq.push_back(boost::move(elem));
return sbq;
}
template <typename ValueType>
sync_queue<ValueType>& operator<<(sync_queue<ValueType>& sbq, ValueType const&elem)
{
- sbq.push(elem);
+ sbq.push_back(elem);
return sbq;
}
template <typename ValueType>
sync_queue<ValueType>& operator>>(sync_queue<ValueType>& sbq, ValueType &elem)
{
- sbq.pull(elem);
+ sbq.pull_front(elem);
return sbq;
}
Modified: branches/release/boost/thread/synchronized_value.hpp
==============================================================================
--- branches/release/boost/thread/synchronized_value.hpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/boost/thread/synchronized_value.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -472,8 +472,8 @@
*/
synchronized_value(BOOST_THREAD_RV_REF(synchronized_value) other)
{
- strict_lock<mutex_type> lk(other.mtx_);
- value_= boost::move(other.value_);
+ strict_lock<mutex_type> lk(BOOST_THREAD_RV(other).mtx_);
+ value_= boost::move(BOOST_THREAD_RV(other).value_);
}
// mutation
Copied and modified: branches/release/boost/thread/thread_pool.hpp (from r85961, trunk/boost/thread/thread_pool.hpp)
==============================================================================
--- trunk/boost/thread/thread_pool.hpp Thu Sep 26 10:10:37 2013 (r85961, copy source)
+++ branches/release/boost/thread/thread_pool.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -15,19 +15,8 @@
#include <boost/thread/detail/move.hpp>
#include <boost/thread/scoped_thread.hpp>
#include <boost/thread/sync_queue.hpp>
-#include <boost/thread/detail/function_wrapper.hpp>
-
-#ifdef BOOST_NO_CXX11_HDR_FUNCTIONAL
-#include <boost/function.hpp>
-#else
-#include <functional>
-#endif
-
-#if defined BOOST_NO_CXX11_RVALUE_REFERENCES
-#include <boost/container/vector.hpp>
-#else
-#include <vector>
-#endif
+#include <boost/thread/detail/work.hpp>
+#include <boost/thread/csbl/vector.hpp>
#include <boost/config/abi_prefix.hpp>
@@ -37,21 +26,18 @@
class thread_pool
{
/// type-erasure to store the works to do
- typedef detail::function_wrapper work;
+ typedef thread_detail::work work;
/// the kind of stored threads are scoped threads to ensure that the threads are joined.
/// A move aware vector type
typedef scoped_thread<> thread_t;
-#if defined BOOST_NO_CXX11_RVALUE_REFERENCES
- typedef container::vector<thread_t> thread_vector;
-#else
- typedef std::vector<thread_t> thread_vector;
-#endif
+ typedef csbl::vector<thread_t> thread_vector;
/// the thread safe work queue
sync_queue<work > work_queue;
/// A move aware vector
thread_vector threads;
+ public:
/**
* Effects: try to execute one task.
* Returns: whether a task has been executed.
@@ -62,14 +48,14 @@
work task;
try
{
- if (work_queue.try_pull(task))
+ if (work_queue.try_pull_front(task) == queue_op_status::success)
{
task();
return true;
}
return false;
}
- catch (std::exception& ex)
+ catch (std::exception& )
{
return false;
}
@@ -78,6 +64,7 @@
return false;
}
}
+ private:
/**
* Effects: schedule one task or yields
* Throws: whatever the current task constructor throws or the task() throws.
@@ -89,15 +76,19 @@
this_thread::yield();
}
}
+
/**
* The main loop of the worker threads
*/
void worker_thread()
{
- while (!is_closed())
+ while (!closed())
{
schedule_one_or_yield();
}
+ while (try_executing_one())
+ {
+ }
}
public:
@@ -105,15 +96,23 @@
BOOST_THREAD_NO_COPYABLE(thread_pool)
/**
- * Effects: creates a thread pool that runs closures on @c thread_count threads.
+ * \b Effects: creates a thread pool that runs closures on \c thread_count threads.
+ *
+ * \b Throws: Whatever exception is thrown while initializing the needed resources.
*/
thread_pool(unsigned const thread_count = thread::hardware_concurrency())
{
try
{
+ threads.reserve(thread_count);
for (unsigned i = 0; i < thread_count; ++i)
{
+#if 1
+ thread th (&thread_pool::worker_thread, this);
+ threads.push_back(thread_t(boost::move(th)));
+#else
threads.push_back(thread_t(&thread_pool::worker_thread, this));
+#endif
}
}
catch (...)
@@ -123,8 +122,9 @@
}
}
/**
- * Effects: Destroys the thread pool.
- * Synchronization: The completion of all the closures happen before the completion of the thread pool destructor.
+ * \b Effects: Destroys the thread pool.
+ *
+ * \b Synchronization: The completion of all the closures happen before the completion of the \c thread_pool destructor.
*/
~thread_pool()
{
@@ -134,7 +134,8 @@
}
/**
- * Effects: close the thread_pool for submissions. The worker threads will work until
+ * \b Effects: close the \c thread_pool for submissions.
+ * The worker threads will work until there is no more closures to run.
*/
void close()
{
@@ -142,45 +143,64 @@
}
/**
- * Returns: whether the pool is closed for submissions.
+ * \b Returns: whether the pool is closed for submissions.
*/
- bool is_closed()
+ bool closed()
{
return work_queue.closed();
}
/**
- * Effects: The specified function will be scheduled for execution at some point in the future.
- * If invoking closure throws an exception the thread pool will call std::terminate, as is the case with threads.
- * Synchronization: completion of closure on a particular thread happens before destruction of thread's thread local variables.
- * Throws: sync_queue_is_closed if the thread pool is closed.
+ * \b Requires: \c Closure is a model of \c Callable(void()) and a model of \c CopyConstructible/MoveConstructible.
+ *
+ * \b Effects: The specified \c closure will be scheduled for execution at some point in the future.
+ * If invoked closure throws an exception the \c thread_pool will call \c std::terminate, as is the case with threads.
*
+ * \b Synchronization: completion of \c closure on a particular thread happens before destruction of thread's thread local variables.
+ *
+ * \b Throws: \c sync_queue_is_closed if the thread pool is closed.
+ * Whatever exception that can be throw while storing the closure.
*/
+
+#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template <typename Closure>
- void submit(Closure const& closure)
+ void submit(Closure & closure)
+ {
+ work w ((closure));
+ work_queue.push_back(boost::move(w));
+ //work_queue.push(work(closure)); // todo check why this doesn't work
+ }
+#endif
+ void submit(void (*closure)())
{
work w ((closure));
- work_queue.push(boost::move(w));
- //work_queue.push(work(closure));
+ work_queue.push_back(boost::move(w));
+ //work_queue.push_back(work(closure)); // todo check why this doesn't work
}
+
template <typename Closure>
void submit(BOOST_THREAD_RV_REF(Closure) closure)
{
work w =boost::move(closure);
- work_queue.push(boost::move(w));
- //work_queue.push(work(boost::move(closure)));
+ work_queue.push_back(boost::move(w));
+ //work_queue.push_back(work(boost::move(closure))); // todo check why this doesn't work
}
/**
- * This must be called from an scheduled task.
- * Effects: reschedule functions until pred()
+ * \b Requires: This must be called from an scheduled task.
+ *
+ * \b Effects: reschedule functions until pred()
*/
template <typename Pred>
- void reschedule_until(Pred const& pred)
+ bool reschedule_until(Pred const& pred)
{
do {
- schedule_one_or_yield();
+ if ( ! try_executing_one())
+ {
+ return false;
+ }
} while (! pred());
+ return true;
}
};
Copied and modified: branches/release/boost/thread/user_scheduler.hpp (from r86594, trunk/boost/thread/user_scheduler.hpp)
==============================================================================
--- trunk/boost/thread/user_scheduler.hpp Sat Nov 9 06:47:43 2013 (r86594, copy source)
+++ branches/release/boost/thread/user_scheduler.hpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -39,7 +39,7 @@
work task;
try
{
- if (work_queue.try_pull(task))
+ if (work_queue.try_pull_front(task) == queue_op_status::success)
{
task();
return true;
@@ -144,23 +144,23 @@
void submit(Closure & closure)
{
work w ((closure));
- work_queue.push(boost::move(w));
+ work_queue.push_back(boost::move(w));
//work_queue.push(work(closure)); // todo check why this doesn't work
}
#endif
void submit(void (*closure)())
{
work w ((closure));
- work_queue.push(boost::move(w));
- //work_queue.push(work(closure)); // todo check why this doesn't work
+ work_queue.push_back(boost::move(w));
+ //work_queue.push_back(work(closure)); // todo check why this doesn't work
}
template <typename Closure>
void submit(BOOST_THREAD_RV_REF(Closure) closure)
{
work w =boost::move(closure);
- work_queue.push(boost::move(w));
- //work_queue.push(work(boost::move(closure))); // todo check why this doesn't work
+ work_queue.push_back(boost::move(w));
+ //work_queue.push_back(work(boost::move(closure))); // todo check why this doesn't work
}
/**
Modified: branches/release/libs/thread/doc/scoped_thread.qbk
==============================================================================
--- branches/release/libs/thread/doc/scoped_thread.qbk Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/libs/thread/doc/scoped_thread.qbk 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -216,6 +216,7 @@
void detach();
static unsigned hardware_concurrency() noexcept;
+ static unsigned physical_concurrency() noexcept;
typedef thread::native_handle_type native_handle_type;
native_handle_type native_handle();
@@ -458,6 +459,20 @@
[endsect]
+
+[section:physical_concurrency Static member function `physical_concurrency()`]
+
+ unsigned physical_concurrency() noexecpt;
+
+[variablelist
+
+[[Effects:] [Equivalent to return `thread::physical_concurrency()`.]]
+
+]
+
+[endsect]
+
+
[section:nativehandle Member function `native_handle()`]
typedef thread::native_handle_type native_handle_type;
Modified: branches/release/libs/thread/doc/thread.qbk
==============================================================================
--- branches/release/libs/thread/doc/thread.qbk Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/libs/thread/doc/thread.qbk 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -249,7 +249,7 @@
[section:sds Synchronized Data Structures]
[include synchronized_value.qbk]
-[/include sync_queues_ref.qbk]
+[include sync_queues_ref.qbk]
[/include sync_streams.qbk]
[endsect]
Modified: branches/release/libs/thread/doc/thread_ref.qbk
==============================================================================
--- branches/release/libs/thread/doc/thread_ref.qbk Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/libs/thread/doc/thread_ref.qbk 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -470,6 +470,7 @@
void detach();
static unsigned hardware_concurrency() noexcept;
+ static unsigned physical_concurrency() noexcept;
typedef platform-specific-type native_handle_type;
native_handle_type native_handle();
@@ -991,6 +992,21 @@
[endsect]
+[section:physical_concurrency Static member function `physical_concurrency()`]
+
+ unsigned physical_concurrency() noexecpt;
+
+[variablelist
+
+[[Returns:] [The number of physical cores available on the current system. In contrast to `hardware_concurrency()` it does not return
+ the number of virtual cores, but it counts only physical cores.]]
+
+[[Throws:] [Nothing]]
+
+]
+
+[endsect]
+
[section:nativehandle Member function `native_handle()`]
typedef platform-specific-type native_handle_type;
Copied and modified: branches/release/libs/thread/example/executor.cpp (from r86161, trunk/libs/thread/example/executor.cpp)
==============================================================================
--- trunk/libs/thread/example/executor.cpp Fri Oct 4 16:05:26 2013 (r86161, copy source)
+++ branches/release/libs/thread/example/executor.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -4,146 +4,97 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#define BOOST_THREAD_VERSION 4
-#define BOOST_THREAD_USES_LOG
+#define BOOST_THREAD_PROVIDES_EXECUTORS
#define BOOST_THREAD_USES_LOG_THREAD_ID
+#define BOOST_THREAD_QUEUE_DEPRECATE_OLD
-#include <boost/thread/detail/log.hpp>
#include <boost/thread/thread_pool.hpp>
+#include <boost/thread/user_scheduler.hpp>
#include <boost/thread/executor.hpp>
+#include <boost/thread/future.hpp>
#include <boost/assert.hpp>
#include <string>
+#include <boost/thread/caller_context.hpp>
void p1()
{
- BOOST_THREAD_LOG
- << boost::this_thread::get_id() << " P1" << BOOST_THREAD_END_LOG;
+ std::cout << BOOST_CONTEXTOF << std::endl;
}
void p2()
{
- BOOST_THREAD_LOG
- << boost::this_thread::get_id() << " P2" << BOOST_THREAD_END_LOG;
+ std::cout << BOOST_CONTEXTOF << std::endl;
}
-void push(boost::container::deque<boost::detail::function_wrapper> &data_, BOOST_THREAD_RV_REF(boost::detail::function_wrapper) closure)
+int f1()
{
- try
- {
- BOOST_THREAD_LOG
- << boost::this_thread::get_id() << " <MAIN" << BOOST_THREAD_END_LOG;
- boost::detail::function_wrapper v;
- BOOST_THREAD_LOG
- << boost::this_thread::get_id() << " <MAIN" << BOOST_THREAD_END_LOG;
- //v = boost::move(closure);
- //v = boost::forward<boost::detail::function_wrapper>(closure);
- BOOST_THREAD_LOG
- << boost::this_thread::get_id() << " <MAIN" << BOOST_THREAD_END_LOG;
-
- data_.push_back(boost::move(closure));
- BOOST_THREAD_LOG
- << boost::this_thread::get_id() << " <MAIN" << BOOST_THREAD_END_LOG;
-
- //data_.push_back(boost::forward<boost::detail::function_wrapper>(closure));
- BOOST_THREAD_LOG
- << boost::this_thread::get_id() << " <MAIN" << BOOST_THREAD_END_LOG;
-
- }
- catch (std::exception& ex)
- {
- BOOST_THREAD_LOG
- << "ERRORRRRR " << ex.what() << "" << BOOST_THREAD_END_LOG;
- }
- catch (...)
- {
- BOOST_THREAD_LOG
- << " ERRORRRRR exception thrown" << BOOST_THREAD_END_LOG;
- }
+ std::cout << BOOST_CONTEXTOF << std::endl;
+ boost::this_thread::sleep_for(boost::chrono::seconds(1));
+ return 1;
}
-
-template <typename Closure>
-void submit(boost::container::deque<boost::detail::function_wrapper> &data_, BOOST_THREAD_FWD_REF(Closure) closure)
+int f2(int i)
{
- BOOST_THREAD_LOG
- << boost::this_thread::get_id() << " <MAIN" << BOOST_THREAD_END_LOG;
- //work w =boost::move(closure);
- //work_queue.push(boost::move(w));
- //push(data_, boost::detail::function_wrapper(boost::forward<Closure>(closure)));
- boost::detail::function_wrapper v =boost::forward<Closure>(closure);
- BOOST_THREAD_LOG
- << boost::this_thread::get_id() << " <MAIN" << BOOST_THREAD_END_LOG;
- push(data_, boost::move(v));
+ std::cout << BOOST_CONTEXTOF << std::endl;
+ boost::this_thread::sleep_for(boost::chrono::seconds(2));
+ return i + 1;
+}
- BOOST_THREAD_LOG
- << boost::this_thread::get_id() << " <MAIN" << BOOST_THREAD_END_LOG;
+void submit_some(boost::executor& tp)
+{
+ tp.submit(&p1);
+ tp.submit(&p2);
+ tp.submit(&p1);
+ tp.submit(&p2);
+ tp.submit(&p1);
+ tp.submit(&p2);
+ tp.submit(&p1);
+ tp.submit(&p2);
+ tp.submit(&p1);
+ tp.submit(&p2);
}
int main()
{
- BOOST_THREAD_LOG
- << boost::this_thread::get_id() << " <MAIN" << BOOST_THREAD_END_LOG;
-#if 0
- {
- try
- {
- boost::detail::function_wrapper f(&p1);
-
- boost::container::deque<boost::detail::function_wrapper> data_;
- data_.push_back(boost::move(f));
- data_.push_back(boost::detail::function_wrapper(&p1));
- submit(data_, &p1);
- }
- catch (std::exception& ex)
- {
- BOOST_THREAD_LOG
- << "ERRORRRRR " << ex.what() << "" << BOOST_THREAD_END_LOG;
- }
- catch (...)
- {
- BOOST_THREAD_LOG
- << " ERRORRRRR exception thrown" << BOOST_THREAD_END_LOG;
- }
-
- typedef boost::container::vector<boost::thread> thread_vector;
- thread_vector threads;
-
- }
-#endif
-#if 1
+ std::cout << BOOST_CONTEXTOF << std::endl;
{
try
{
boost::executor_adaptor<boost::thread_pool> ea;
- boost::executor &tp=ea;
- BOOST_THREAD_LOG
- << boost::this_thread::get_id() << " <MAIN" << BOOST_THREAD_END_LOG;
- tp.submit(&p1);
- BOOST_THREAD_LOG
- << boost::this_thread::get_id() << " <MAIN" << BOOST_THREAD_END_LOG;
- tp.submit(&p2);
- tp.submit(&p1);
- tp.submit(&p2);
- tp.submit(&p1);
- tp.submit(&p2);
- tp.submit(&p1);
- tp.submit(&p2);
- tp.submit(&p1);
- tp.submit(&p2);
+ submit_some(ea);
+ {
+ boost::future<int> t1 = boost::async(ea, &f1);
+ boost::future<int> t2 = boost::async(ea, &f1);
+ std::cout << BOOST_CONTEXTOF << " t1= " << t1.get() << std::endl;
+ std::cout << BOOST_CONTEXTOF << " t2= " << t2.get() << std::endl;
+ }
+ submit_some(ea);
+ {
+ boost::thread_pool ea3(1);
+ boost::future<int> t1 = boost::async(ea3, &f1);
+ boost::future<int> t2 = boost::async(ea3, &f1);
+ //boost::future<int> t2 = boost::async(ea3, f2, 1); // todo this doesn't compiles yet on C++11
+ //boost::future<int> t2 = boost::async(ea3, boost::bind(f2, 1)); // todo this doesn't compiles yet on C++98
+ std::cout << BOOST_CONTEXTOF << " t1= " << t1.get() << std::endl;
+ std::cout << BOOST_CONTEXTOF << " t2= " << t2.get() << std::endl;
+ }
+ submit_some(ea);
+
+ boost::executor_adaptor<boost::user_scheduler> ea2;
+ submit_some(ea2);
+ ea2.underlying_executor().run_queued_closures();
+
}
catch (std::exception& ex)
{
- BOOST_THREAD_LOG
- << "ERRORRRRR " << ex.what() << "" << BOOST_THREAD_END_LOG;
+ std::cout << "ERROR= " << ex.what() << "" << std::endl;
return 1;
}
catch (...)
{
- BOOST_THREAD_LOG
- << " ERRORRRRR exception thrown" << BOOST_THREAD_END_LOG;
+ std::cout << " ERROR= exception thrown" << std::endl;
return 2;
}
}
-#endif
- BOOST_THREAD_LOG
- << boost::this_thread::get_id() << "MAIN>" << BOOST_THREAD_END_LOG;
+ std::cout << BOOST_CONTEXTOF << std::endl;
return 0;
}
Modified: branches/release/libs/thread/example/future_fallback_to.cpp
==============================================================================
--- branches/release/libs/thread/example/future_fallback_to.cpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/libs/thread/example/future_fallback_to.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -36,9 +36,15 @@
for (int i=0; i< number_of_tests; i++)
try
{
- boost::future<int> f1 = boost::async(boost::launch::async, &p1);
+ //boost::future<int> f1 = boost::async(boost::launch::async, &p1);
+ BOOST_THREAD_LOG << "" << BOOST_THREAD_END_LOG;
+ boost::future<int> f1 = boost::async(&p1);
+ BOOST_THREAD_LOG << "" << BOOST_THREAD_END_LOG;
boost::future<int> f2 = f1.fallback_to(-1);
- assert(f2.get()==1);
+ BOOST_THREAD_LOG << "" << BOOST_THREAD_END_LOG;
+ f2.wait();
+ BOOST_ASSERT(f2.get()==1);
+ BOOST_THREAD_LOG << "" << BOOST_THREAD_END_LOG;
}
catch (std::exception& ex)
{
@@ -48,17 +54,24 @@
}
catch (...)
{
+ std::cout << " ERRORRRRR exception thrown" << std::endl;
BOOST_THREAD_LOG << " ERRORRRRR exception thrown" << BOOST_THREAD_END_LOG;
return 2;
}
}
+
{
for (int i=0; i< number_of_tests; i++)
try
{
+ BOOST_THREAD_LOG << "" << BOOST_THREAD_END_LOG;
boost::future<int> f1 = boost::async(boost::launch::async, &p1_ex);
+ BOOST_THREAD_LOG << "" << BOOST_THREAD_END_LOG;
boost::future<int> f2 = f1.fallback_to(-1);
- assert(f2.get()==-1);
+ BOOST_THREAD_LOG << "" << BOOST_THREAD_END_LOG;
+ f2.wait();
+ BOOST_ASSERT(f2.get()==-1);
+ BOOST_THREAD_LOG << "" << BOOST_THREAD_END_LOG;
}
catch (std::exception& ex)
{
@@ -68,6 +81,7 @@
}
catch (...)
{
+ std::cout << " ERRORRRRR exception thrown" << std::endl;
BOOST_THREAD_LOG << " ERRORRRRR exception thrown" << BOOST_THREAD_END_LOG;
return 2;
}
Modified: branches/release/libs/thread/example/future_unwrap.cpp
==============================================================================
--- branches/release/libs/thread/example/future_unwrap.cpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/libs/thread/example/future_unwrap.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -38,8 +38,8 @@
{
boost::future<boost::future<int> > outer_future = boost::async(boost::launch::async, &p2);
boost::future<int> inner_future = outer_future.unwrap();
- int i = inner_future.get();
- BOOST_THREAD_LOG << "i= "<< i << "" << BOOST_THREAD_END_LOG;
+ int ii = inner_future.get();
+ BOOST_THREAD_LOG << "ii= "<< ii << "" << BOOST_THREAD_END_LOG;
}
catch (std::exception& ex)
{
@@ -49,6 +49,7 @@
}
catch (...)
{
+ std::cout << " ERRORRRRR exception thrown" << std::endl;
BOOST_THREAD_LOG << " ERRORRRRR exception thrown" << BOOST_THREAD_END_LOG;
return 2;
}
Copied and modified: branches/release/libs/thread/example/future_when_all.cpp (from r86356, trunk/libs/thread/example/future_when_all.cpp)
==============================================================================
--- trunk/libs/thread/example/future_when_all.cpp Fri Oct 18 13:32:46 2013 (r86356, copy source)
+++ branches/release/libs/thread/example/future_when_all.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -26,6 +26,7 @@
#include <boost/thread/future.hpp>
+#include <boost/thread/csbl/vector.hpp>
#include <boost/assert.hpp>
#include <boost/thread/detail/log.hpp>
#include <string>
@@ -103,9 +104,9 @@
boost::future<int> f1 = boost::async(boost::launch::async, &p1);
boost::future<int> f2 = boost::async(boost::launch::async, &p1b);
boost::future<std::tuple<> > all0 = boost::when_all();
- boost::future<BOOST_THREAD_VECTOR<boost::future<int> > > all = boost::when_all(boost::move(f1), boost::move(f2));
+ boost::future<boost::csbl::vector<boost::future<int> > > all = boost::when_all(boost::move(f1), boost::move(f2));
//(void) all.wait();
- BOOST_THREAD_VECTOR<boost::future<int> > res = all.get();
+ boost::csbl::vector<boost::future<int> > res = all.get();
BOOST_THREAD_LOG
<< res[0].get() <<" " << BOOST_THREAD_END_LOG;
BOOST_THREAD_LOG
@@ -130,9 +131,9 @@
boost::future<int> f1 = boost::async(boost::launch::async, &p1);
boost::future<int> f2 = boost::async(boost::launch::async, &p1b);
boost::future<std::tuple<> > all0 = boost::when_any();
- boost::future<BOOST_THREAD_VECTOR<boost::future<int> > > all = boost::when_any(boost::move(f1), boost::move(f2));
+ boost::future<boost::csbl::vector<boost::future<int> > > all = boost::when_any(boost::move(f1), boost::move(f2));
//(void) all.wait();
- BOOST_THREAD_VECTOR<boost::future<int> > res = all.get();
+ boost::csbl::vector<boost::future<int> > res = all.get();
BOOST_THREAD_LOG
<< res[0].get() <<" " << BOOST_THREAD_END_LOG;
BOOST_THREAD_LOG
@@ -156,21 +157,17 @@
return 0;
}
#else
-#include <boost/container/vector.hpp>
-#define BOOST_THREAD_VECTOR boost::container::vector
+#include <boost/thread/csbl/vector.hpp>
using namespace boost;
-//#include <vector>
-//#define BOOST_THREAD_VECTOR std::vector
-//using namespace std;
-void f( BOOST_THREAD_VECTOR<future<int> > &//vec
+void f( boost::csbl::vector<future<int> > &//vec
, BOOST_THREAD_RV_REF(future<int>) //f
) {
//vec.push_back(boost::forward<future<int> >(f));
}
int main()
{
- BOOST_THREAD_VECTOR<future<int> > vec;
+ boost::csbl::vector<future<int> > vec;
f(vec, make_ready_future(0));
return 0;
}
Modified: branches/release/libs/thread/example/lambda_future.cpp
==============================================================================
--- branches/release/libs/thread/example/lambda_future.cpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/libs/thread/example/lambda_future.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -21,6 +21,7 @@
#if defined BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION \
&& ! defined BOOST_NO_CXX11_LAMBDAS
+
int main()
{
const int number_of_tests = 100;
@@ -49,6 +50,7 @@
}
catch (...)
{
+ std::cout << " ERRORRRRR exception thrown" << std::endl;
BOOST_THREAD_LOG << " ERRORRRRR exception thrown" << BOOST_THREAD_END_LOG;
return 2;
}
Copied: branches/release/libs/thread/example/not_interleaved2.cpp (from r85759, trunk/libs/thread/example/not_interleaved2.cpp)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/libs/thread/example/not_interleaved2.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770, copy of r85759, trunk/libs/thread/example/not_interleaved2.cpp)
@@ -0,0 +1,61 @@
+// (C) Copyright 2012 Howard Hinnant
+// (C) Copyright 2012 Vicente Botet
+//
+// 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)
+
+// adapted from the example given by Howard Hinnant in
+
+#define BOOST_THREAD_VERSION 4
+
+#include <iostream>
+#include <boost/thread/scoped_thread.hpp>
+#include <boost/thread/ostream_buffer.hpp>
+
+void use_cerr()
+{
+ using namespace boost;
+ chrono::steady_clock::time_point tf = chrono::steady_clock::now() + chrono::seconds(5);
+ int i = 0;
+ while (chrono::steady_clock::now() < tf)
+ {
+ ostream_buffer<std::ostream> mcerr(std::cerr);
+ mcerr.stream() << "logging data to cerr " << i++ << "\n";
+ this_thread::sleep_for(chrono::milliseconds(250));
+ }
+}
+
+void use_cout()
+{
+ using namespace boost;
+ chrono::steady_clock::time_point tf = chrono::steady_clock::now() + chrono::seconds(5);
+ int i = 0;
+ while (chrono::steady_clock::now() < tf)
+ {
+ ostream_buffer<std::ostream> mcout(std::cout);
+ mcout.stream() << "logging data to cout " << i++ << "\n";
+ this_thread::sleep_for(chrono::milliseconds(500));
+ }
+}
+
+int main()
+{
+ using namespace boost;
+
+ scoped_thread<> t1(&use_cerr);
+ scoped_thread<> t2(&use_cout);
+ this_thread::sleep_for(chrono::seconds(2));
+ std::string nm = "he, he\n";
+ {
+ ostream_buffer<std::ostream> mcout(std::cout);
+ mcout.stream() << "Enter name: \n";
+ }
+ t1.join();
+ t2.join();
+ {
+ ostream_buffer<std::ostream> mcout(std::cout);
+ mcout.stream() << nm;
+ }
+ return 0;
+}
+
Modified: branches/release/libs/thread/example/producer_consumer.cpp
==============================================================================
--- branches/release/libs/thread/example/producer_consumer.cpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/libs/thread/example/producer_consumer.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -7,21 +7,28 @@
// adapted from the example given by Howard Hinnant in
#define BOOST_THREAD_VERSION 4
+#define BOOST_THREAD_QUEUE_DEPRECATE_OLD
#include <iostream>
#include <boost/thread/scoped_thread.hpp>
+#ifdef XXXX
#include <boost/thread/externally_locked_stream.hpp>
+ typedef boost::externally_locked_stream<std::ostream> the_ostream;
+#else
+ typedef std::ostream the_ostream;
+ typedef std::istream the_istream;
+#endif
#include <boost/thread/sync_queue.hpp>
-void producer(boost::externally_locked_stream<std::ostream> &mos, boost::sync_queue<int> & sbq)
+void producer(the_ostream &mos, boost::sync_queue<int> & sbq)
{
using namespace boost;
try {
for(int i=0; ;++i)
{
- //sbq.push(i);
- sbq << i;
- mos << "push(" << i << ") "<< sbq.size()<<"\n";
+ sbq.push_back(i);
+ //sbq << i;
+ mos << "push_back(" << i << ") "<< sbq.size()<<"\n";
this_thread::sleep_for(chrono::milliseconds(200));
}
}
@@ -35,16 +42,19 @@
}
}
-void consumer(boost::externally_locked_stream<std::ostream> &mos, boost::sync_queue<int> & sbq)
+void consumer(
+ the_ostream &mos,
+ boost::sync_queue<int> & sbq)
{
using namespace boost;
try {
for(int i=0; ;++i)
{
int r;
- //sbq.pull(r);
- sbq >> r;
+ sbq.pull_front(r);
+ //sbq >> r;
mos << i << " pull(" << r << ") "<< sbq.size()<<"\n";
+
this_thread::sleep_for(chrono::milliseconds(250));
}
}
@@ -57,17 +67,18 @@
mos << "exception !!!\n";
}
}
-void consumer2(boost::externally_locked_stream<std::ostream> &mos, boost::sync_queue<int> & sbq)
+void consumer2(the_ostream &mos, boost::sync_queue<int> & sbq)
{
using namespace boost;
try {
- bool closed=false;
for(int i=0; ;++i)
{
int r;
- sbq.pull(r, closed);
- if (closed) break;
- mos << i << " pull(" << r << ")\n";
+ queue_op_status st = sbq.try_pull_front(r);
+ if (queue_op_status::closed == st) break;
+ if (queue_op_status::success == st) {
+ mos << i << " pull(" << r << ")\n";
+ }
this_thread::sleep_for(chrono::milliseconds(250));
}
}
@@ -76,7 +87,7 @@
mos << "exception !!!\n";
}
}
-//void consumer3(boost::externally_locked_stream<std::ostream> &mos, boost::sync_queue<int> & sbq)
+//void consumer3(the_ostream &mos, boost::sync_queue<int> & sbq)
//{
// using namespace boost;
// bool closed=false;
@@ -100,11 +111,17 @@
{
using namespace boost;
+#ifdef XXXX
recursive_mutex terminal_mutex;
externally_locked_stream<std::ostream> mcerr(std::cerr, terminal_mutex);
externally_locked_stream<std::ostream> mcout(std::cout, terminal_mutex);
externally_locked_stream<std::istream> mcin(std::cin, terminal_mutex);
+#else
+ the_ostream &mcerr = std::cout;
+ the_ostream &mcout = std::cerr;
+ //the_istream &mcin = std::cin;
+#endif
sync_queue<int> sbq;
Modified: branches/release/libs/thread/example/producer_consumer_bounded.cpp
==============================================================================
--- branches/release/libs/thread/example/producer_consumer_bounded.cpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/libs/thread/example/producer_consumer_bounded.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -7,21 +7,29 @@
// adapted from the example given by Howard Hinnant in
#define BOOST_THREAD_VERSION 4
+#define BOOST_THREAD_QUEUE_DEPRECATE_OLD
#include <iostream>
#include <boost/thread/scoped_thread.hpp>
+#ifdef XXXX
#include <boost/thread/externally_locked_stream.hpp>
+ typedef boost::externally_locked_stream<std::ostream> the_ostream;
+#else
+ typedef std::ostream the_ostream;
+ typedef std::istream the_istream;
+#endif
+
#include <boost/thread/sync_bounded_queue.hpp>
-void producer(boost::externally_locked_stream<std::ostream> &mos, boost::sync_bounded_queue<int> & sbq)
+void producer(the_ostream &mos, boost::sync_bounded_queue<int> & sbq)
{
using namespace boost;
try {
for(int i=0; ;++i)
{
- //sbq.push(i);
- sbq << i;
- mos << "push(" << i << ") "<< sbq.size()<<"\n";
+ sbq.push_back(i);
+ //sbq << i;
+ mos << "push_back(" << i << ") "<< sbq.size()<<"\n";
this_thread::sleep_for(chrono::milliseconds(200));
}
}
@@ -35,16 +43,16 @@
}
}
-void consumer(boost::externally_locked_stream<std::ostream> &mos, boost::sync_bounded_queue<int> & sbq)
+void consumer(the_ostream &mos, boost::sync_bounded_queue<int> & sbq)
{
using namespace boost;
try {
for(int i=0; ;++i)
{
int r;
- //sbq.pull(r);
- sbq >> r;
- mos << i << " pull(" << r << ") "<< sbq.size()<<"\n";
+ sbq.pull_front(r);
+ //sbq >> r;
+ mos << i << " pull_front(" << r << ") "<< sbq.size()<<"\n";
this_thread::sleep_for(chrono::milliseconds(250));
}
}
@@ -57,17 +65,18 @@
mos << "exception !!!\n";
}
}
-void consumer2(boost::externally_locked_stream<std::ostream> &mos, boost::sync_bounded_queue<int> & sbq)
+void consumer2(the_ostream &mos, boost::sync_bounded_queue<int> & sbq)
{
using namespace boost;
try {
- bool closed=false;
for(int i=0; ;++i)
{
int r;
- sbq.pull(r, closed);
- if (closed) break;
- mos << i << " pull(" << r << ")\n";
+ queue_op_status st = sbq.try_pull_front(r);
+ if (queue_op_status::closed == st) break;
+ if (queue_op_status::success == st) {
+ mos << i << " pull(" << r << ")\n";
+ }
this_thread::sleep_for(chrono::milliseconds(250));
}
}
@@ -76,7 +85,7 @@
mos << "exception !!!\n";
}
}
-//void consumer3(boost::externally_locked_stream<std::ostream> &mos, boost::sync_bounded_queue<int> & sbq)
+//void consumer3(the_ostream &mos, boost::sync_bounded_queue<int> & sbq)
//{
// using namespace boost;
// bool closed=false;
@@ -99,12 +108,17 @@
int main()
{
using namespace boost;
-
+#ifdef XXXX
recursive_mutex terminal_mutex;
externally_locked_stream<std::ostream> mcerr(std::cerr, terminal_mutex);
externally_locked_stream<std::ostream> mcout(std::cout, terminal_mutex);
externally_locked_stream<std::istream> mcin(std::cin, terminal_mutex);
+#else
+ the_ostream &mcerr = std::cout;
+ the_ostream &mcout = std::cerr;
+ //the_istream &mcin = std::cin;
+#endif
sync_bounded_queue<int> sbq(10);
Copied and modified: branches/release/libs/thread/example/thread_pool.cpp (from r85961, trunk/libs/thread/example/thread_pool.cpp)
==============================================================================
--- trunk/libs/thread/example/thread_pool.cpp Thu Sep 26 10:10:37 2013 (r85961, copy source)
+++ branches/release/libs/thread/example/thread_pool.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -6,6 +6,7 @@
#define BOOST_THREAD_VERSION 4
#define BOOST_THREAD_USES_LOG
#define BOOST_THREAD_USES_LOG_THREAD_ID
+#define BOOST_THREAD_QUEUE_DEPRECATE_OLD
#include <boost/thread/detail/log.hpp>
#include <boost/thread/thread_pool.hpp>
@@ -24,108 +25,29 @@
<< boost::this_thread::get_id() << " P2" << BOOST_THREAD_END_LOG;
}
-void push(boost::container::deque<boost::detail::function_wrapper> &data_, BOOST_THREAD_RV_REF(boost::detail::function_wrapper) closure)
-{
- try
- {
- BOOST_THREAD_LOG
- << boost::this_thread::get_id() << " <MAIN" << BOOST_THREAD_END_LOG;
- boost::detail::function_wrapper v;
- BOOST_THREAD_LOG
- << boost::this_thread::get_id() << " <MAIN" << BOOST_THREAD_END_LOG;
- //v = boost::move(closure);
- //v = boost::forward<boost::detail::function_wrapper>(closure);
- BOOST_THREAD_LOG
- << boost::this_thread::get_id() << " <MAIN" << BOOST_THREAD_END_LOG;
-
- data_.push_back(boost::move(closure));
- BOOST_THREAD_LOG
- << boost::this_thread::get_id() << " <MAIN" << BOOST_THREAD_END_LOG;
-
- //data_.push_back(boost::forward<boost::detail::function_wrapper>(closure));
- BOOST_THREAD_LOG
- << boost::this_thread::get_id() << " <MAIN" << BOOST_THREAD_END_LOG;
-
- }
- catch (std::exception& ex)
- {
- BOOST_THREAD_LOG
- << "ERRORRRRR " << ex.what() << "" << BOOST_THREAD_END_LOG;
- }
- catch (...)
- {
- BOOST_THREAD_LOG
- << " ERRORRRRR exception thrown" << BOOST_THREAD_END_LOG;
- }
+void submit_some(boost::thread_pool& tp) {
+ tp.submit(&p1);
+ tp.submit(&p2);
+ tp.submit(&p1);
+ tp.submit(&p2);
+ tp.submit(&p1);
+ tp.submit(&p2);
+ tp.submit(&p1);
+ tp.submit(&p2);
+ tp.submit(&p1);
+ tp.submit(&p2);
}
-template <typename Closure>
-void submit(boost::container::deque<boost::detail::function_wrapper> &data_, BOOST_THREAD_FWD_REF(Closure) closure)
-{
- BOOST_THREAD_LOG
- << boost::this_thread::get_id() << " <MAIN" << BOOST_THREAD_END_LOG;
- //work w =boost::move(closure);
- //work_queue.push(boost::move(w));
- //push(data_, boost::detail::function_wrapper(boost::forward<Closure>(closure)));
- boost::detail::function_wrapper v =boost::forward<Closure>(closure);
- BOOST_THREAD_LOG
- << boost::this_thread::get_id() << " <MAIN" << BOOST_THREAD_END_LOG;
- push(data_, boost::move(v));
-
- BOOST_THREAD_LOG
- << boost::this_thread::get_id() << " <MAIN" << BOOST_THREAD_END_LOG;
-}
int main()
{
BOOST_THREAD_LOG
<< boost::this_thread::get_id() << " <MAIN" << BOOST_THREAD_END_LOG;
-#if 0
- {
- try
- {
- boost::detail::function_wrapper f(&p1);
-
- boost::container::deque<boost::detail::function_wrapper> data_;
- data_.push_back(boost::move(f));
- data_.push_back(boost::detail::function_wrapper(&p1));
- submit(data_, &p1);
- }
- catch (std::exception& ex)
- {
- BOOST_THREAD_LOG
- << "ERRORRRRR " << ex.what() << "" << BOOST_THREAD_END_LOG;
- }
- catch (...)
- {
- BOOST_THREAD_LOG
- << " ERRORRRRR exception thrown" << BOOST_THREAD_END_LOG;
- }
-
- typedef boost::container::vector<boost::thread> thread_vector;
- thread_vector threads;
-
- }
-#endif
-#if 1
{
try
{
boost::thread_pool tp;
- BOOST_THREAD_LOG
- << boost::this_thread::get_id() << " <MAIN" << BOOST_THREAD_END_LOG;
- tp.submit(&p1);
- BOOST_THREAD_LOG
- << boost::this_thread::get_id() << " <MAIN" << BOOST_THREAD_END_LOG;
- tp.submit(&p2);
- tp.submit(&p1);
- tp.submit(&p2);
- tp.submit(&p1);
- tp.submit(&p2);
- tp.submit(&p1);
- tp.submit(&p2);
- tp.submit(&p1);
- tp.submit(&p2);
+ submit_some(tp);
}
catch (std::exception& ex)
{
@@ -140,7 +62,6 @@
return 2;
}
}
-#endif
BOOST_THREAD_LOG
<< boost::this_thread::get_id() << "MAIN>" << BOOST_THREAD_END_LOG;
return 0;
Copied: branches/release/libs/thread/example/user_scheduler.cpp (from r86594, trunk/libs/thread/example/user_scheduler.cpp)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/libs/thread/example/user_scheduler.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770, copy of r86594, trunk/libs/thread/example/user_scheduler.cpp)
@@ -0,0 +1,70 @@
+// Copyright (C) 2013 Vicente Botet
+//
+// 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)
+
+#define BOOST_THREAD_VERSION 4
+#define BOOST_THREAD_USES_LOG
+#define BOOST_THREAD_USES_LOG_THREAD_ID
+
+#include <boost/thread/detail/log.hpp>
+#include <boost/thread/user_scheduler.hpp>
+#include <boost/assert.hpp>
+#include <string>
+
+void p1()
+{
+ BOOST_THREAD_LOG
+ << boost::this_thread::get_id() << " P1" << BOOST_THREAD_END_LOG;
+}
+
+void p2()
+{
+ BOOST_THREAD_LOG
+ << boost::this_thread::get_id() << " P2" << BOOST_THREAD_END_LOG;
+}
+
+void submit_some(boost::user_scheduler& tp) {
+ tp.submit(&p1);
+ tp.submit(&p2);
+ tp.submit(&p1);
+ tp.submit(&p2);
+ tp.submit(&p1);
+ tp.submit(&p2);
+ tp.submit(&p1);
+ tp.submit(&p2);
+ tp.submit(&p1);
+ tp.submit(&p2);
+}
+
+int main()
+{
+ BOOST_THREAD_LOG
+ << boost::this_thread::get_id() << " <MAIN" << BOOST_THREAD_END_LOG;
+ {
+ try
+ {
+ boost::user_scheduler tp;
+ submit_some(tp);
+ tp.run_queued_closures();
+ submit_some(tp);
+ tp.run_queued_closures();
+ }
+ catch (std::exception& ex)
+ {
+ BOOST_THREAD_LOG
+ << "ERRORRRRR " << ex.what() << "" << BOOST_THREAD_END_LOG;
+ return 1;
+ }
+ catch (...)
+ {
+ BOOST_THREAD_LOG
+ << " ERRORRRRR exception thrown" << BOOST_THREAD_END_LOG;
+ return 2;
+ }
+ }
+
+ BOOST_THREAD_LOG
+ << boost::this_thread::get_id() << "MAIN>" << BOOST_THREAD_END_LOG;
+ return 0;
+}
Modified: branches/release/libs/thread/src/future.cpp
==============================================================================
--- branches/release/libs/thread/src/future.cpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/libs/thread/src/future.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -8,6 +8,7 @@
#include <boost/thread/future_error_code.hpp>
+#include <string>
namespace boost
{
Modified: branches/release/libs/thread/src/pthread/thread.cpp
==============================================================================
--- branches/release/libs/thread/src/pthread/thread.cpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/libs/thread/src/pthread/thread.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -27,6 +27,15 @@
#include <unistd.h>
#endif
+#include <boost/algorithm/string/split.hpp>
+#include <boost/algorithm/string/trim.hpp>
+#include <boost/lexical_cast.hpp>
+
+#include <fstream>
+#include <string>
+#include <set>
+#include <vector>
+
#include "./timeconv.inl"
namespace boost
@@ -217,7 +226,7 @@
thread_data_base* make_external_thread_data()
{
- thread_data_base* const me(new externally_launched_thread());
+ thread_data_base* const me(detail::heap_new<externally_launched_thread>());
me->self.reset(me);
set_current_thread_data(me);
return me;
@@ -543,6 +552,62 @@
#endif
}
+ unsigned thread::physical_concurrency() BOOST_NOEXCEPT
+ {
+#ifdef __linux__
+ try {
+ using namespace std;
+
+ ifstream proc_cpuinfo ("/proc/cpuinfo");
+
+ const string physical_id("physical id"), core_id("core id");
+
+ typedef std::pair<unsigned, unsigned> core_entry; // [physical ID, core id]
+
+ std::set<core_entry> cores;
+
+ core_entry current_core_entry;
+
+ string line;
+ while ( getline(proc_cpuinfo, line) ) {
+ if (line.empty())
+ continue;
+
+ vector<string> key_val(2);
+ boost::split(key_val, line, boost::is_any_of(":"));
+
+ if (key_val.size() != 2)
+ return 0;
+
+ string key = key_val[0];
+ string value = key_val[1];
+ boost::trim(key);
+ boost::trim(value);
+
+ if (key == physical_id) {
+ current_core_entry.first = boost::lexical_cast<unsigned>(value);
+ continue;
+ }
+
+ if (key == core_id) {
+ current_core_entry.second = boost::lexical_cast<unsigned>(value);
+ cores.insert(current_core_entry);
+ continue;
+ }
+ }
+ return cores.size();
+ } catch(...) {
+ return 0;
+ }
+#elif defined(__APPLE__)
+ int count;
+ size_t size=sizeof(count);
+ return sysctlbyname("hw.physicalcpu",&count,&size,NULL,0)?0:count;
+#else
+ return hardware_concurrency();
+#endif
+ }
+
#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
void thread::interrupt()
{
@@ -670,7 +735,7 @@
{
detail::thread_data_base* const current_thread_data(get_or_make_current_thread_data());
thread_exit_callback_node* const new_node=
- new thread_exit_callback_node(func,current_thread_data->thread_exit_callbacks);
+ heap_new<thread_exit_callback_node>(func,current_thread_data->thread_exit_callbacks);
current_thread_data->thread_exit_callbacks=new_node;
}
Modified: branches/release/libs/thread/src/win32/thread.cpp
==============================================================================
--- branches/release/libs/thread/src/win32/thread.cpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/libs/thread/src/win32/thread.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -407,6 +407,8 @@
return local_thread_info.get() && (detail::win32::WaitForSingleObject(local_thread_info->interruption_handle,0)==0);
}
+#endif
+
unsigned thread::hardware_concurrency() BOOST_NOEXCEPT
{
//SYSTEM_INFO info={{0}};
@@ -414,7 +416,28 @@
GetSystemInfo(&info);
return info.dwNumberOfProcessors;
}
-#endif
+
+ unsigned thread::physical_concurrency() BOOST_NOEXCEPT
+ {
+ unsigned cores = 0;
+ DWORD size = 0;
+
+ GetLogicalProcessorInformation(NULL, &size);
+ if (ERROR_INSUFFICIENT_BUFFER != GetLastError())
+ return 0;
+
+ std::vector<SYSTEM_LOGICAL_PROCESSOR_INFORMATION> buffer(size);
+ if (GetLogicalProcessorInformation(&buffer.front(), &size) == FALSE)
+ return 0;
+
+ const size_t Elements = size / sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION);
+
+ for (size_t i = 0; i < Elements; ++i) {
+ if (buffer[i].Relationship == RelationProcessorCore)
+ ++cores;
+ }
+ return cores;
+ }
thread::native_handle_type thread::native_handle()
{
Modified: branches/release/libs/thread/test/Jamfile.v2
==============================================================================
--- branches/release/libs/thread/test/Jamfile.v2 Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/libs/thread/test/Jamfile.v2 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -209,6 +209,7 @@
[ thread-test test_thread.cpp ]
[ thread-test test_thread_id.cpp ]
[ thread-test test_hardware_concurrency.cpp ]
+ [ thread-test test_physical_concurrency.cpp ]
[ thread-test test_thread_move.cpp ]
[ thread-test test_thread_return_local.cpp ]
[ thread-test test_thread_move_return.cpp ]
@@ -278,6 +279,8 @@
#[ thread-run test_7160.cpp ]
[ thread-run test_7328.cpp ]
[ thread-run test_7571.cpp ]
+ [ thread-run test_9319.cpp ]
+
;
@@ -716,6 +719,11 @@
[ thread-run2 ../example/producer_consumer.cpp : ex_producer_consumer ]
[ thread-run2 ../example/not_interleaved.cpp : ex_not_interleaved ]
[ thread-run2 ../example/lambda_future.cpp : ex_lambda_future ]
+ [ thread-run2 ../example/not_interleaved2.cpp : ex_not_interleaved2 ]
+ [ thread-run2 ../example/thread_pool.cpp : ex_thread_pool ]
+ [ thread-run2 ../example/user_scheduler.cpp : ex_user_scheduler ]
+ [ thread-run2 ../example/executor.cpp : ex_executor ]
+ [ thread-run2 ../example/future_when_all.cpp : future_when_all ]
;
@@ -772,29 +780,41 @@
;
+ explicit ts_more ;
+ test-suite ts_more
+ :
+ [ thread-run test_7666.cpp ]
+ [ thread-run test_7720.cpp ]
+ [ thread-run test_7755.cpp ]
+ [ thread-run test_8455.cpp ]
+ [ thread-run test_8508.cpp ]
+ #[ thread-run test_8557.cpp ]
+ [ thread-run test_8586.cpp ]
+ [ thread-run test_8943.cpp ]
+ [ thread-run test_8960.cpp ]
+ [ thread-run test_9079_a.cpp ]
+ [ thread-run test_9079_b.cpp ]
+ [ thread-run test_9192.cpp ]
+ ;
+
+ explicit ts_more_cpp11 ;
+ test-suite ts_more_cpp11
+ :
+ [ thread-run test_8596.cpp ]
+ [ thread-run test_8600.cpp ]
+ ;
+
explicit ts_ ;
test-suite ts_
:
-
#[ thread-run ../example/test_so.cpp ]
#[ thread-run ../example/test_so2.cpp ]
-
- #[ compile virtual_noexcept.cpp ]
- #[ thread-run test_7720.cpp ]
- #[ thread-run test_7666.cpp ]
- #[ thread-run test_7755.cpp ]
#[ thread-run ../example/perf_condition_variable.cpp ]
#[ thread-run ../example/perf_shared_mutex.cpp ]
#[ thread-run ../example/std_async_test.cpp ]
- #[ thread-run test_8508.cpp ]
- #[ thread-run test_8586.cpp ]
- #[ thread-run test_8596.cpp ]
- #[ thread-run test_8600.cpp ]
- #[ thread-run test_8943.cpp ]
- #[ thread-run test_8960.cpp ]
- [ thread-run test_9079_a.cpp ]
- [ thread-run test_9079_b.cpp ]
-
+ #[ compile virtual_noexcept.cpp ]
+ #[ thread-run clang_main.cpp ]
+ #[ thread-run test_9303.cpp ]
;
}
Modified: branches/release/libs/thread/test/sync/futures/async/async_pass.cpp
==============================================================================
--- branches/release/libs/thread/test/sync/futures/async/async_pass.cpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/libs/thread/test/sync/futures/async/async_pass.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -22,16 +22,23 @@
// future<typename result_of<F(Args...)>::type>
// async(launch policy, F&& f, Args&&... args);
+// template <class Executor, class F, class... Args>
+// future<typename result_of<F(Args...)>::type>
+// async(Executor& ex, F&& f, Args&&... args);
+
//#define BOOST_THREAD_VERSION 3
#define BOOST_THREAD_VERSION 4
+#define BOOST_THREAD_PROVIDES_EXECUTORS
#include <iostream>
#include <boost/thread/future.hpp>
#include <boost/thread/thread.hpp>
#include <boost/thread/detail/memory.hpp>
-#include <boost/interprocess/smart_ptr/unique_ptr.hpp>
+#include <boost/thread/csbl/memory/unique_ptr.hpp>
#include <memory>
#include <boost/detail/lightweight_test.hpp>
+#include <boost/thread/thread_pool.hpp>
+#include <boost/thread/executor.hpp>
typedef boost::chrono::high_resolution_clock Clock;
typedef boost::chrono::milliseconds ms;
@@ -114,10 +121,10 @@
boost::this_thread::sleep_for(ms(200));
}
-boost::interprocess::unique_ptr<int, boost::default_delete<int> > f3_0()
+boost::csbl::unique_ptr<int> f3_0()
{
boost::this_thread::sleep_for(ms(200));
- boost::interprocess::unique_ptr<int, boost::default_delete<int> > r( (new int(3)));
+ boost::csbl::unique_ptr<int> r( (new int(3)));
return boost::move(r);
}
MoveOnly f3_1()
@@ -127,14 +134,14 @@
return boost::move(r);
}
-boost::interprocess::unique_ptr<int, boost::default_delete<int> > f3(int i)
+boost::csbl::unique_ptr<int> f3(int i)
{
boost::this_thread::sleep_for(ms(200));
- return boost::interprocess::unique_ptr<int, boost::default_delete<int> >(new int(i));
+ return boost::csbl::unique_ptr<int>(new int(i));
}
-boost::interprocess::unique_ptr<int, boost::default_delete<int> > f4(
- BOOST_THREAD_RV_REF_BEG boost::interprocess::unique_ptr<int, boost::default_delete<int> > BOOST_THREAD_RV_REF_END p
+boost::csbl::unique_ptr<int> f4(
+ BOOST_THREAD_RV_REF_BEG boost::csbl::unique_ptr<int> BOOST_THREAD_RV_REF_END p
)
{
boost::this_thread::sleep_for(ms(200));
@@ -210,6 +217,30 @@
}
}
+#ifdef BOOST_THREAD_PROVIDES_EXECUTORS
+ {
+ try
+ {
+ boost::executor_adaptor<boost::thread_pool> ex(1);
+ boost::future<int> f = boost::async(ex, &f0);
+ boost::this_thread::sleep_for(ms(300));
+ Clock::time_point t0 = Clock::now();
+ BOOST_TEST(f.get() == 3);
+ Clock::time_point t1 = Clock::now();
+ BOOST_TEST(t1 - t0 < ms(300));
+ std::cout << __FILE__ << "[" << __LINE__ << "] " << (t1 - t0).count() << std::endl;
+ }
+ catch (std::exception& ex)
+ {
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << ex.what() << std::endl;
+ BOOST_TEST(false && "exception thrown");
+ }
+ catch (...)
+ {
+ BOOST_TEST(false && "exception thrown");
+ }
+ }
+#endif
std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
{
try
@@ -233,17 +264,43 @@
}
}
+#ifdef BOOST_THREAD_PROVIDES_EXECUTORS2
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
+ {
+ try
+ {
+ boost::executor_adaptor<boost::thread_pool> ex(1);
+ boost::future<long> f = boost::async(ex, A(3));
+ boost::this_thread::sleep_for(ms(300));
+ Clock::time_point t0 = Clock::now();
+ BOOST_TEST(f.get() == 3);
+ Clock::time_point t1 = Clock::now();
+ BOOST_TEST(t1 - t0 < ms(300));
+ std::cout << __FILE__ << "[" << __LINE__ << "] " << (t1 - t0).count() << std::endl;
+ }
+ catch (std::exception& ex)
+ {
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << ex.what() << std::endl;
+ BOOST_TEST(false && "exception thrown");
+ }
+ catch (...)
+ {
+ BOOST_TEST(false && "exception thrown");
+ }
+
+ }
+#endif
std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
{
try
{
boost::future<int> f = boost::async(boost::launch::async, BOOST_THREAD_MAKE_RV_REF(MoveOnly()));
- // boost::this_thread::sleep_for(ms(300));
- // Clock::time_point t0 = Clock::now();
- // BOOST_TEST(f.get() == 3);
- // Clock::time_point t1 = Clock::now();
- // BOOST_TEST(t1 - t0 < ms(300));
- // std::cout << __FILE__ <<"["<<__LINE__<<"] "<< (t1 - t0).count() << std::endl;
+ boost::this_thread::sleep_for(ms(300));
+ Clock::time_point t0 = Clock::now();
+ BOOST_TEST(f.get() == 3);
+ Clock::time_point t1 = Clock::now();
+ BOOST_TEST(t1 - t0 < ms(300));
+ std::cout << __FILE__ <<"["<<__LINE__<<"] "<< (t1 - t0).count() << std::endl;
}
catch (std::exception& ex)
{
@@ -255,6 +312,33 @@
BOOST_TEST(false && "exception thrown");
}
}
+#ifdef BOOST_THREAD_PROVIDES_EXECUTORS2
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
+ {
+ try
+ {
+ boost::executor_adaptor<boost::thread_pool> ex(1);
+ MoveOnly mo;
+ boost::future<int> f = boost::async(ex, boost::move(mo));
+ //boost::future<int> f = boost::async(ex, MoveOnly());
+ boost::this_thread::sleep_for(ms(300));
+ Clock::time_point t0 = Clock::now();
+ BOOST_TEST(f.get() == 3);
+ Clock::time_point t1 = Clock::now();
+ BOOST_TEST(t1 - t0 < ms(300));
+ std::cout << __FILE__ <<"["<<__LINE__<<"] "<< (t1 - t0).count() << std::endl;
+ }
+ catch (std::exception& ex)
+ {
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << ex.what() << std::endl;
+ BOOST_TEST(false && "exception thrown");
+ }
+ catch (...)
+ {
+ BOOST_TEST(false && "exception thrown");
+ }
+ }
+#endif
std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
{
try
@@ -526,7 +610,7 @@
{
try
{
- boost::future<boost::interprocess::unique_ptr<int, boost::default_delete<int> > > f = boost::async(&f3_0);
+ boost::future<boost::csbl::unique_ptr<int> > f = boost::async(&f3_0);
boost::this_thread::sleep_for(ms(300));
Clock::time_point t0 = Clock::now();
BOOST_TEST(*f.get() == 3);
@@ -550,7 +634,7 @@
{
try
{
- boost::future<boost::interprocess::unique_ptr<int, boost::default_delete<int> > > f = boost::async(boost::launch::async, &f3, 3);
+ boost::future<boost::csbl::unique_ptr<int> > f = boost::async(boost::launch::async, &f3, 3);
boost::this_thread::sleep_for(ms(300));
Clock::time_point t0 = Clock::now();
BOOST_TEST(*f.get() == 3);
@@ -572,7 +656,7 @@
{
try
{
- boost::future<boost::interprocess::unique_ptr<int, boost::default_delete<int> > > f = boost::async(&f3, 3);
+ boost::future<boost::csbl::unique_ptr<int> > f = boost::async(&f3, 3);
boost::this_thread::sleep_for(ms(300));
Clock::time_point t0 = Clock::now();
BOOST_TEST(*f.get() == 3);
@@ -597,7 +681,7 @@
{
try
{
- boost::future<boost::interprocess::unique_ptr<int, boost::default_delete<int> > > f = boost::async(boost::launch::async, &f4, boost::interprocess::unique_ptr<int, boost::default_delete<int> >(new int(3)));
+ boost::future<boost::csbl::unique_ptr<int> > f = boost::async(boost::launch::async, &f4, boost::csbl::unique_ptr<int>(new int(3)));
boost::this_thread::sleep_for(ms(300));
Clock::time_point t0 = Clock::now();
BOOST_TEST(*f.get() == 3);
@@ -619,7 +703,7 @@
{
try
{
- boost::future<boost::interprocess::unique_ptr<int, boost::default_delete<int> > > f = boost::async(&f4, boost::interprocess::unique_ptr<int, boost::default_delete<int> >(new int(3)));
+ boost::future<boost::csbl::unique_ptr<int> > f = boost::async(&f4, boost::csbl::unique_ptr<int>(new int(3)));
boost::this_thread::sleep_for(ms(300));
Clock::time_point t0 = Clock::now();
BOOST_TEST(*f.get() == 3);
Modified: branches/release/libs/thread/test/sync/futures/packaged_task/use_allocator_pass.cpp
==============================================================================
--- branches/release/libs/thread/test/sync/futures/packaged_task/use_allocator_pass.cpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/libs/thread/test/sync/futures/packaged_task/use_allocator_pass.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -38,7 +38,7 @@
int main()
{
- BOOST_STATIC_ASSERT_MSG((boost::uses_allocator<boost::packaged_task<BOOST_THREAD_DETAIL_SIGNATURE>, test_allocator<double> >::value), "");
+ BOOST_STATIC_ASSERT_MSG((boost::csbl::uses_allocator<boost::packaged_task<BOOST_THREAD_DETAIL_SIGNATURE>, test_allocator<double> >::value), "");
return boost::report_errors();
}
Modified: branches/release/libs/thread/test/sync/futures/promise/set_rvalue_at_thread_exit_pass.cpp
==============================================================================
--- branches/release/libs/thread/test/sync/futures/promise/set_rvalue_at_thread_exit_pass.cpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/libs/thread/test/sync/futures/promise/set_rvalue_at_thread_exit_pass.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -23,21 +23,22 @@
#include <boost/thread/future.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <boost/thread/detail/memory.hpp>
-#include <boost/interprocess/smart_ptr/unique_ptr.hpp>
+//#include <boost/interprocess/smart_ptr/unique_ptr.hpp>
+#include <boost/thread/csbl/memory/unique_ptr.hpp>
-//void func(boost::promise<boost::interprocess::unique_ptr<int, boost::default_delete<int> > > p)
-boost::promise<boost::interprocess::unique_ptr<int, boost::default_delete<int> > > p;
+//void func(boost::promise<boost::csbl::unique_ptr<int> > p)
+boost::promise<boost::csbl::unique_ptr<int> > p;
void func()
{
- boost::interprocess::unique_ptr<int, boost::default_delete<int> > uptr(new int(5));
+ boost::csbl::unique_ptr<int> uptr(new int(5));
p.set_value_at_thread_exit(boost::move(uptr));
}
int main()
{
{
- //boost::promise<boost::interprocess::unique_ptr<int, boost::default_delete<int>> > p;
- boost::future<boost::interprocess::unique_ptr<int, boost::default_delete<int> > > f = p.get_future();
+ //boost::promise<boost::csbl::unique_ptr<int> > > p;
+ boost::future<boost::csbl::unique_ptr<int> > f = p.get_future();
//boost::thread(func, boost::move(p)).detach();
boost::thread(func).detach();
BOOST_TEST(*f.get() == 5);
Modified: branches/release/libs/thread/test/sync/futures/promise/use_allocator_pass.cpp
==============================================================================
--- branches/release/libs/thread/test/sync/futures/promise/use_allocator_pass.cpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/libs/thread/test/sync/futures/promise/use_allocator_pass.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -30,9 +30,9 @@
int main()
{
- BOOST_STATIC_ASSERT_MSG((boost::uses_allocator<boost::promise<int>, test_allocator<int> >::value), "");
- BOOST_STATIC_ASSERT_MSG((boost::uses_allocator<boost::promise<int&>, test_allocator<int&> >::value), "");
- BOOST_STATIC_ASSERT_MSG((boost::uses_allocator<boost::promise<void>, test_allocator<void> >::value), "");
+ BOOST_STATIC_ASSERT_MSG((boost::csbl::uses_allocator<boost::promise<int>, test_allocator<int> >::value), "");
+ BOOST_STATIC_ASSERT_MSG((boost::csbl::uses_allocator<boost::promise<int&>, test_allocator<int&> >::value), "");
+ BOOST_STATIC_ASSERT_MSG((boost::csbl::uses_allocator<boost::promise<void>, test_allocator<void> >::value), "");
return boost::report_errors();
}
Modified: branches/release/libs/thread/test/sync/mutual_exclusion/sync_bounded_queue/single_thread_pass.cpp
==============================================================================
--- branches/release/libs/thread/test/sync/mutual_exclusion/sync_bounded_queue/single_thread_pass.cpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/libs/thread/test/sync/mutual_exclusion/sync_bounded_queue/single_thread_pass.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -15,6 +15,26 @@
#include <boost/detail/lightweight_test.hpp>
+class non_copyable
+{
+ BOOST_THREAD_MOVABLE_ONLY(non_copyable)
+ int val;
+public:
+ non_copyable() {}
+ non_copyable(int v) : val(v){}
+ non_copyable(BOOST_RV_REF(non_copyable) x): val(x.val) {}
+ non_copyable& operator=(BOOST_RV_REF(non_copyable) x) { val=x.val; return *this; }
+ bool operator==(non_copyable const& x) const {return val==x.val;}
+ template <typename OSTREAM>
+ friend OSTREAM& operator <<(OSTREAM& os, non_copyable const&x )
+ {
+ os << x.val;
+ return os;
+ }
+
+};
+
+
int main()
{
@@ -57,6 +77,16 @@
}
{
// empty queue push rvalue succeeds
+ boost::sync_bounded_queue<non_copyable> q(2);
+ non_copyable nc(1);
+ q.push(boost::move(nc));
+ BOOST_TEST(! q.empty());
+ BOOST_TEST(! q.full());
+ BOOST_TEST_EQ(q.size(), 1u);
+ BOOST_TEST(! q.closed());
+ }
+ {
+ // empty queue push rvalue succeeds
boost::sync_bounded_queue<int> q(2);
q.push(1);
q.push(2);
@@ -85,6 +115,16 @@
BOOST_TEST(! q.closed());
}
{
+ // empty queue try_push rvalue succeeds
+ boost::sync_bounded_queue<non_copyable> q(2);
+ non_copyable nc(1);
+ BOOST_TEST(q.try_push(boost::move(nc)));
+ BOOST_TEST(! q.empty());
+ BOOST_TEST(! q.full());
+ BOOST_TEST_EQ(q.size(), 1u);
+ BOOST_TEST(! q.closed());
+ }
+ {
// empty queue try_push value succeeds
boost::sync_bounded_queue<int> q(2);
int i;
@@ -104,6 +144,16 @@
BOOST_TEST(! q.closed());
}
{
+ // empty queue try_push rvalue succeeds
+ boost::sync_bounded_queue<non_copyable> q(2);
+ non_copyable nc(1);
+ BOOST_TEST(q.try_push(boost::no_block, boost::move(nc)));
+ BOOST_TEST(! q.empty());
+ BOOST_TEST(! q.full());
+ BOOST_TEST_EQ(q.size(), 1u);
+ BOOST_TEST(! q.closed());
+ }
+ {
// 1-element queue pull succeed
boost::sync_bounded_queue<int> q(2);
q.push(1);
@@ -117,6 +167,19 @@
}
{
// 1-element queue pull succeed
+ boost::sync_bounded_queue<non_copyable> q(2);
+ non_copyable nc(1);
+ q.push(boost::move(nc));
+ non_copyable nc2(2);
+ q.pull(nc2);
+ BOOST_TEST_EQ(nc, nc2);
+ BOOST_TEST(q.empty());
+ BOOST_TEST(! q.full());
+ BOOST_TEST_EQ(q.size(), 0u);
+ BOOST_TEST(! q.closed());
+ }
+ {
+ // 1-element queue pull succeed
boost::sync_bounded_queue<int> q(2);
q.push(1);
int i = q.pull();
Modified: branches/release/libs/thread/test/sync/mutual_exclusion/sync_queue/multi_thread_pass.cpp
==============================================================================
--- branches/release/libs/thread/test/sync/mutual_exclusion/sync_queue/multi_thread_pass.cpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/libs/thread/test/sync/mutual_exclusion/sync_queue/multi_thread_pass.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -24,36 +24,36 @@
struct call_push
{
- boost::sync_queue<int> &q_;
- boost::barrier& go_;
+ boost::sync_queue<int> *q_;
+ boost::barrier *go_;
- call_push(boost::sync_queue<int> &q, boost::barrier &go) :
+ call_push(boost::sync_queue<int> *q, boost::barrier *go) :
q_(q), go_(go)
{
}
typedef void result_type;
void operator()()
{
- go_.count_down_and_wait();
- q_.push(42);
+ go_->count_down_and_wait();
+ q_->push(42);
}
};
struct call_pull
{
- boost::sync_queue<int> &q_;
- boost::barrier& go_;
+ boost::sync_queue<int> *q_;
+ boost::barrier *go_;
- call_pull(boost::sync_queue<int> &q, boost::barrier &go) :
+ call_pull(boost::sync_queue<int> *q, boost::barrier *go) :
q_(q), go_(go)
{
}
typedef int result_type;
int operator()()
{
- go_.count_down_and_wait();
- return q_.pull();
+ go_->count_down_and_wait();
+ return q_->pull();
}
};
@@ -76,7 +76,7 @@
q.push(42);
}
#else
- call_push(q,go)
+ call_push(&q,&go)
#endif
);
pull_done=boost::async(boost::launch::async,
@@ -87,7 +87,7 @@
return q.pull();
}
#else
- call_pull(q,go)
+ call_pull(&q,&go)
#endif
);
@@ -119,7 +119,7 @@
q.push(42);
}
#else
- call_push(q,go)
+ call_push(&q,&go)
#endif
);
@@ -160,7 +160,7 @@
return q.pull();
}
#else
- call_pull(q,go)
+ call_pull(&q,&go)
#endif
);
Modified: branches/release/libs/thread/test/sync/mutual_exclusion/sync_queue/single_thread_pass.cpp
==============================================================================
--- branches/release/libs/thread/test/sync/mutual_exclusion/sync_queue/single_thread_pass.cpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/libs/thread/test/sync/mutual_exclusion/sync_queue/single_thread_pass.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -15,6 +15,26 @@
#include <boost/detail/lightweight_test.hpp>
+class non_copyable
+{
+ BOOST_THREAD_MOVABLE_ONLY(non_copyable)
+ int val;
+public:
+ non_copyable(int v) : val(v){}
+ non_copyable(BOOST_RV_REF(non_copyable) x): val(x.val) {}
+ non_copyable& operator=(BOOST_RV_REF(non_copyable) x) { val=x.val; return *this; }
+ bool operator==(non_copyable const& x) const {return val==x.val;}
+ template <typename OSTREAM>
+ friend OSTREAM& operator <<(OSTREAM& os, non_copyable const&x )
+ {
+ os << x.val;
+ return os;
+ }
+
+};
+
+
+
int main()
{
@@ -46,7 +66,7 @@
BOOST_TEST(! q.closed());
}
{
- // empty queue push rvalue succeeds
+ // empty queue push rvalue/copyable succeeds
boost::sync_queue<int> q;
q.push(1);
BOOST_TEST(! q.empty());
@@ -55,6 +75,38 @@
BOOST_TEST(! q.closed());
}
{
+ // empty queue push lvalue/copyable succeeds
+ boost::sync_queue<int> q;
+ int i;
+ q.push(i);
+ BOOST_TEST(! q.empty());
+ BOOST_TEST(! q.full());
+ BOOST_TEST_EQ(q.size(), 1u);
+ BOOST_TEST(! q.closed());
+ }
+#if 0
+ {
+ // empty queue push rvalue/non_copyable succeeds
+ boost::sync_queue<non_copyable> q;
+ q.push(non_copyable(1));
+ BOOST_TEST(! q.empty());
+ BOOST_TEST(! q.full());
+ BOOST_TEST_EQ(q.size(), 1u);
+ BOOST_TEST(! q.closed());
+ }
+#endif
+ {
+ // empty queue push rvalue/non_copyable succeeds
+ boost::sync_queue<non_copyable> q;
+ non_copyable nc(1);
+ q.push(boost::move(nc));
+ BOOST_TEST(! q.empty());
+ BOOST_TEST(! q.full());
+ BOOST_TEST_EQ(q.size(), 1u);
+ BOOST_TEST(! q.closed());
+ }
+
+ {
// empty queue push rvalue succeeds
boost::sync_queue<int> q;
q.push(1);
@@ -65,7 +117,7 @@
BOOST_TEST(! q.closed());
}
{
- // empty queue push value succeeds
+ // empty queue push lvalue succeeds
boost::sync_queue<int> q;
int i;
q.push(i);
@@ -75,7 +127,7 @@
BOOST_TEST(! q.closed());
}
{
- // empty queue try_push rvalue succeeds
+ // empty queue try_push rvalue/copyable succeeds
boost::sync_queue<int> q;
BOOST_TEST(q.try_push(1));
BOOST_TEST(! q.empty());
@@ -84,7 +136,38 @@
BOOST_TEST(! q.closed());
}
{
- // empty queue try_push value succeeds
+ // empty queue try_push rvalue/copyable succeeds
+ boost::sync_queue<int> q;
+ BOOST_TEST(q.try_push(1));
+ BOOST_TEST(! q.empty());
+ BOOST_TEST(! q.full());
+ BOOST_TEST_EQ(q.size(), 1u);
+ BOOST_TEST(! q.closed());
+ }
+#if 0
+ {
+ // empty queue try_push rvalue/non-copyable succeeds
+ boost::sync_queue<non_copyable> q;
+ BOOST_TEST(q.try_push(non_copyable()));
+ BOOST_TEST(! q.empty());
+ BOOST_TEST(! q.full());
+ BOOST_TEST_EQ(q.size(), 1u);
+ BOOST_TEST(! q.closed());
+ }
+#endif
+ {
+ // empty queue try_push rvalue/non-copyable succeeds
+ boost::sync_queue<non_copyable> q;
+ non_copyable nc(1);
+ BOOST_TEST(q.try_push(boost::move(nc)));
+ BOOST_TEST(! q.empty());
+ BOOST_TEST(! q.full());
+ BOOST_TEST_EQ(q.size(), 1u);
+ BOOST_TEST(! q.closed());
+ }
+
+ {
+ // empty queue try_push lvalue succeeds
boost::sync_queue<int> q;
int i;
BOOST_TEST(q.try_push(i));
@@ -102,6 +185,27 @@
BOOST_TEST_EQ(q.size(), 1u);
BOOST_TEST(! q.closed());
}
+#if 0
+ {
+ // empty queue try_push rvalue/non-copyable succeeds
+ boost::sync_queue<non_copyable> q;
+ BOOST_TEST(q.try_push(boost::no_block, non_copyable(1)));
+ BOOST_TEST(! q.empty());
+ BOOST_TEST(! q.full());
+ BOOST_TEST_EQ(q.size(), 1u);
+ BOOST_TEST(! q.closed());
+ }
+#endif
+ {
+ // empty queue try_push rvalue/non-copyable succeeds
+ boost::sync_queue<non_copyable> q;
+ non_copyable nc(1);
+ BOOST_TEST(q.try_push(boost::no_block, boost::move(nc)));
+ BOOST_TEST(! q.empty());
+ BOOST_TEST(! q.full());
+ BOOST_TEST_EQ(q.size(), 1u);
+ BOOST_TEST(! q.closed());
+ }
{
// 1-element queue pull succeed
boost::sync_queue<int> q;
@@ -116,6 +220,19 @@
}
{
// 1-element queue pull succeed
+ boost::sync_queue<non_copyable> q;
+ non_copyable nc1(1);
+ q.push(boost::move(nc1));
+ non_copyable nc2(2);
+ q.pull(nc2);
+ BOOST_TEST_EQ(nc1, nc2);
+ BOOST_TEST(q.empty());
+ BOOST_TEST(! q.full());
+ BOOST_TEST_EQ(q.size(), 0u);
+ BOOST_TEST(! q.closed());
+ }
+ {
+ // 1-element queue pull succeed
boost::sync_queue<int> q;
q.push(1);
int i = q.pull();
@@ -126,6 +243,18 @@
BOOST_TEST(! q.closed());
}
{
+ // 1-element queue pull succeed
+ boost::sync_queue<non_copyable> q;
+ non_copyable nc1(1);
+ q.push(boost::move(nc1));
+ non_copyable nc = q.pull();
+ BOOST_TEST_EQ(nc, nc1);
+ BOOST_TEST(q.empty());
+ BOOST_TEST(! q.full());
+ BOOST_TEST_EQ(q.size(), 0u);
+ BOOST_TEST(! q.closed());
+ }
+ {
// 1-element queue try_pull succeed
boost::sync_queue<int> q;
q.push(1);
@@ -139,6 +268,19 @@
}
{
// 1-element queue try_pull succeed
+ boost::sync_queue<non_copyable> q;
+ non_copyable nc1(1);
+ q.push(boost::move(nc1));
+ non_copyable nc(2);
+ BOOST_TEST(q.try_pull(nc));
+ BOOST_TEST_EQ(nc, nc1);
+ BOOST_TEST(q.empty());
+ BOOST_TEST(! q.full());
+ BOOST_TEST_EQ(q.size(), 0u);
+ BOOST_TEST(! q.closed());
+ }
+ {
+ // 1-element queue try_pull succeed
boost::sync_queue<int> q;
q.push(1);
int i;
@@ -151,6 +293,19 @@
}
{
// 1-element queue try_pull succeed
+ boost::sync_queue<non_copyable> q;
+ non_copyable nc1(1);
+ q.push(boost::move(nc1));
+ non_copyable nc(2);
+ BOOST_TEST(q.try_pull(boost::no_block, nc));
+ BOOST_TEST_EQ(nc, nc1);
+ BOOST_TEST(q.empty());
+ BOOST_TEST(! q.full());
+ BOOST_TEST_EQ(q.size(), 0u);
+ BOOST_TEST(! q.closed());
+ }
+ {
+ // 1-element queue try_pull succeed
boost::sync_queue<int> q;
q.push(1);
boost::shared_ptr<int> i = q.try_pull();
Modified: branches/release/libs/thread/test/sync/mutual_exclusion/synchronized_value/call_pass.cpp
==============================================================================
--- branches/release/libs/thread/test/sync/mutual_exclusion/synchronized_value/call_pass.cpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/libs/thread/test/sync/mutual_exclusion/synchronized_value/call_pass.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -92,7 +92,7 @@
{
boost::synchronized_value<S> v;
v(&nc);
- //v(&c);
+ v(&c);
}
{
const boost::synchronized_value<S> v;
Modified: branches/release/libs/thread/test/test_7720.cpp
==============================================================================
--- branches/release/libs/thread/test/test_7720.cpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/libs/thread/test/test_7720.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -12,9 +12,11 @@
shared_mutex mtx;
+const int max_count = 100;
void f()
{
- while (true)
+ int count =max_count;
+ while (count--)
{
upgrade_lock<shared_mutex> lock(mtx);
}
@@ -22,7 +24,8 @@
void g()
{
- while (true)
+ int count =max_count;
+ while (count--)
{
shared_lock<shared_mutex> lock(mtx);
}
@@ -30,7 +33,8 @@
void h()
{
- while (true)
+ int count =max_count;
+ while (count--)
{
unique_lock<shared_mutex> lock(mtx);
}
Copied: branches/release/libs/thread/test/test_8455.cpp (from r86546, trunk/libs/thread/test/test_8455.cpp)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/libs/thread/test/test_8455.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770, copy of r86546, trunk/libs/thread/test/test_8455.cpp)
@@ -0,0 +1,23 @@
+// Copyright (C) 2013 Vicente Botet
+//
+// 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)
+
+#include <boost/thread/mutex.hpp>
+boost::mutex mut;
+void boostMutexImp1()
+{
+ boost::mutex::scoped_lock lock(mut);
+ mut.unlock(); // A: with this X blocks
+ //lock.unlock(); // No influence if used also if before A
+}
+void boostMutexImp2()
+{
+ boost::mutex::scoped_lock lock(mut); // X: blocks with A
+}
+int main()
+{
+ boostMutexImp1();
+ boostMutexImp2();
+ return 0;
+}
Copied: branches/release/libs/thread/test/test_8557.cpp (from r86546, trunk/libs/thread/test/test_8557.cpp)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/libs/thread/test/test_8557.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770, copy of r86546, trunk/libs/thread/test/test_8557.cpp)
@@ -0,0 +1,140 @@
+// Copyright (C) 2013 Vicente Botet
+//
+// 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)
+
+// B
+
+#include <malloc.h>
+#include <boost/thread/thread.hpp>
+
+#include <boost/thread/mutex.hpp>
+
+#include <boost/bind.hpp>
+
+#include <iostream>
+
+ static void
+ display_mallinfo()
+ {
+ struct mallinfo mi;
+
+ mi = mallinfo();
+
+ printf("Total non-mmapped bytes (arena): %d\n", mi.arena);
+ printf("# of free chunks (ordblks): %d\n", mi.ordblks);
+ printf("# of free fastbin blocks (smblks): %d\n", mi.smblks);
+ printf("# of mapped regions (hblks): %d\n", mi.hblks);
+ printf("Bytes in mapped regions (hblkhd): %d\n", mi.hblkhd);
+ printf("Max. total allocated space (usmblks): %d\n", mi.usmblks);
+ printf("Free bytes held in fastbins (fsmblks): %d\n", mi.fsmblks);
+ printf("Total allocated space (uordblks): %d\n", mi.uordblks);
+ printf("Total free space (fordblks): %d\n", mi.fordblks);
+ printf("Topmost releasable block (keepcost): %d\n", mi.keepcost);
+ }
+
+boost::mutex io_mutex;
+
+void count() {
+
+ for (int i = 0; i < 10; ++i) {
+
+ boost::mutex::scoped_lock lock(io_mutex);
+
+ //boost::this_thread::sleep( boost::posix_time::milliseconds( 100 ) );
+
+ }
+
+}
+void* count2(void*) {
+
+ for (int i = 0; i < 10; ++i) {
+
+ boost::mutex::scoped_lock lock(io_mutex);
+
+ boost::this_thread::sleep( boost::posix_time::milliseconds( 100 ) );
+
+ }
+ return 0;
+}
+
+int main() {
+ printf("\n============== sizeof(boost::thread) ============== %d\n", sizeof(boost::thread));
+ printf("\n============== sizeof(boost::detail::thread_data_base) ============== %d\n", sizeof(boost::detail::thread_data_base));
+ printf("\n============== sizeof(boost::detail::thread_data<>) ============== %d\n", sizeof(boost::detail::thread_data<void(*)()>));
+ printf("\n============== Before thread creation ==============\n");
+ display_mallinfo();
+ {
+ boost::thread thrd1(&count);
+
+ printf("\n============== After thread creation ==============\n");
+ display_mallinfo();
+
+ boost::thread thrd2(&count);
+ printf("\n============== After thread creation ==============\n");
+ display_mallinfo();
+ boost::thread thrd3(&count);
+ printf("\n============== After thread creation ==============\n");
+ display_mallinfo();
+
+ thrd1.join();
+ printf("\n============== After thread join ==============\n");
+ display_mallinfo();
+
+ thrd2.join();
+ printf("\n============== After thread join ==============\n");
+ display_mallinfo();
+ thrd3.join();
+ printf("\n============== After thread join ==============\n");
+ display_mallinfo();
+ }
+ printf("\n============== After thread destruction ==============\n");
+ display_mallinfo();
+
+ {
+ pthread_attr_t attr;
+ pthread_attr_init(&attr);
+
+ pthread_t thrd1;
+ pthread_create(&thrd1, &attr, &count2, 0);
+ printf("\n============== After thread creation ==============\n");
+ display_mallinfo();
+
+ pthread_t thrd2;
+ pthread_create(&thrd2, &attr, &count2, 0);
+ printf("\n============== After thread creation ==============\n");
+ display_mallinfo();
+
+ pthread_t thrd3;
+ pthread_create(&thrd3, &attr, &count2, 0);
+ printf("\n============== After thread creation ==============\n");
+ display_mallinfo();
+
+ pthread_attr_destroy(&attr);
+ printf("\n============== After thread attr destroy ==============\n");
+ display_mallinfo();
+
+ void* res;
+ pthread_join(thrd3, &res);
+ printf("\n============== After thread join ==============\n");
+ display_mallinfo();
+
+ pthread_join(thrd2, &res);
+ printf("\n============== After thread join ==============\n");
+ display_mallinfo();
+ pthread_join(thrd1, &res);
+ printf("\n============== After thread join ==============\n");
+ display_mallinfo();
+
+
+
+ //pthread_destroy(&thrd1);
+ //pthread_destroy(&thrd2);
+ //pthread_destroy(&thrd3);
+ }
+ printf("\n============== After thread destruction ==============\n");
+ display_mallinfo();
+
+ return 1;
+
+}
Copied: branches/release/libs/thread/test/test_8586.cpp (from r85759, trunk/libs/thread/test/test_8586.cpp)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/libs/thread/test/test_8586.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770, copy of r85759, trunk/libs/thread/test/test_8586.cpp)
@@ -0,0 +1,18 @@
+// Copyright (C) 2013 Vicente Botet
+//
+// 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)
+
+#include <boost/thread/thread.hpp>
+#include <iostream>
+
+void hello_world()
+{
+ std::cout << "Hello from thread!" << std::endl;
+}
+
+int main()
+{
+ boost::thread my_thread(&hello_world);
+ my_thread.join();
+}
Modified: branches/release/libs/thread/test/test_8596.cpp
==============================================================================
--- branches/release/libs/thread/test/test_8596.cpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/libs/thread/test/test_8596.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -7,7 +7,7 @@
#include <iostream>
#include <functional>
-#include <future>
+//#include <future>
#include <boost/thread.hpp>
#include <boost/shared_ptr.hpp>
Copied: branches/release/libs/thread/test/test_8600.cpp (from r85759, trunk/libs/thread/test/test_8600.cpp)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/libs/thread/test/test_8600.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770, copy of r85759, trunk/libs/thread/test/test_8600.cpp)
@@ -0,0 +1,140 @@
+// Copyright (C) 2013 Vicente Botet
+//
+// 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)
+
+#include <boost/assert.hpp>
+#include <boost/static_assert.hpp>
+#include <vector>
+#include <utility>
+#include <type_traits>
+#if 1
+
+struct B {
+ int v;
+ B(int i) : v(i) {}
+};
+
+struct D: B {
+ D(int i) : B(i) {}
+};
+
+void fb(B const&) {}
+void fd(D const&) {}
+
+BOOST_STATIC_ASSERT(sizeof(B)==sizeof(D));
+
+template <class T, class Allocator=std::allocator<T> >
+class new_vector;
+template <class T, class Allocator>
+class new_vector : public std::vector<T,Allocator>
+{
+ typedef std::vector<T,Allocator> base_type;
+public:
+ new_vector() : base_type() {}
+ new_vector(unsigned s) : base_type(s) {}
+};
+
+template <class Allocator >
+class new_vector<bool, Allocator>
+{
+ //std::vector<char,typename Allocator::template rebind<char>::other > v;
+ int i;
+public:
+};
+
+template <class T, class A>
+typename std::enable_if<!std::is_same<T, bool>::value,
+ new_vector<T,A>&
+>::type
+new_vector_cast(std::vector<T,A> & v) {
+ return reinterpret_cast<new_vector<T,A>&>(v);
+}
+
+BOOST_STATIC_ASSERT(sizeof(std::vector<int>)==sizeof(new_vector<int>));
+BOOST_STATIC_ASSERT(sizeof(std::vector<bool>)!=sizeof(new_vector<bool>));
+
+void fb(std::vector<int> const&) {}
+void fd(new_vector<int> const&) {}
+
+int main() {
+ {
+ std::vector<int> b(1);
+ b[0] = 1;
+ new_vector<int> d = new_vector_cast(b);
+ BOOST_ASSERT(b[0] == d[0]);
+ }
+ {
+ //std::vector<bool> b;
+ //new_vector<bool> d = new_vector_cast(b); // compile fail
+ }
+ {
+ std::vector<int> b(1);
+ b[0] = 1;
+ fd(new_vector_cast(b));
+ }
+ {
+ new_vector<int> d(1);
+ d[0] = 1;
+ std::vector<int> b = d;
+ BOOST_ASSERT(b[0] == d[0]);
+ }
+ {
+ //new_vector<bool> d;
+ //std::vector<bool> b = d; // compile fail
+ }
+ {
+ new_vector<int> d(1);
+ d[0] = 1;
+ fd(d);
+ }
+ return 0;
+}
+
+
+#else
+int main() {
+ {
+ B b(1);
+ D d = reinterpret_cast<D&>(b);
+ BOOST_ASSERT(b.v == d.v);
+ }
+ {
+ B b(1);
+ fd(reinterpret_cast<D&>(b));
+ }
+ {
+ D d(2);
+ B b = d;
+ BOOST_ASSERT(b.v == d.v);
+ }
+ {
+ D d(2);
+ fd(d);
+ }
+ return 0;
+}
+
+#define BOOST_THREAD_VERSION 4
+
+#include <iostream>
+#include <boost/thread.hpp>
+
+int calculate_the_answer_to_life_the_universe_and_everything()
+{
+return 42;
+}
+
+int main()
+{
+boost::packaged_task<int()> pt(calculate_the_answer_to_life_the_universe_and_everything);
+boost::shared_future<int> fi1 = boost::shared_future<int>(pt.get_future());
+boost::shared_future<int> fi2 = fi1;
+
+boost::thread task(boost::move(pt)); // launch task on a thread
+
+boost::wait_for_any(fi1, fi2);
+std::cout << "Wait for any returned\n";
+return (0);
+}
+#endif
Copied: branches/release/libs/thread/test/test_8943.cpp (from r85759, trunk/libs/thread/test/test_8943.cpp)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/libs/thread/test/test_8943.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770, copy of r85759, trunk/libs/thread/test/test_8943.cpp)
@@ -0,0 +1,47 @@
+// Copyright (C) 2013 Vicente Botet
+//
+// 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)
+
+#include <boost/detail/lightweight_test.hpp>
+
+#if defined(WIN32)
+#include <tchar.h>
+#endif
+
+#include <cstdlib>
+#include <iostream>
+#include <boost/thread/once.hpp>
+
+namespace {
+
+class foo
+{
+public:
+ void operator()() const
+ {
+ std::cout << "foo" << std::endl;
+ }
+}; // class foo
+
+}
+
+#if defined(WIN32)
+int _tmain(int /*argc*/, _TCHAR* /*argv*/[])
+#else
+int main(int /*argc*/, char* /*argv*/[])
+#endif
+{
+ try
+ {
+ boost::once_flag once_flag = BOOST_ONCE_INIT;
+ boost::call_once(once_flag, foo());
+ return EXIT_SUCCESS;
+ }
+ catch (...)
+ {
+ std::cerr << "Unknown exception" << std::endl;
+ BOOST_TEST(false);
+ }
+ return boost::report_errors();
+}
Copied: branches/release/libs/thread/test/test_8960.cpp (from r85759, trunk/libs/thread/test/test_8960.cpp)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/libs/thread/test/test_8960.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770, copy of r85759, trunk/libs/thread/test/test_8960.cpp)
@@ -0,0 +1,53 @@
+// Copyright (C) 2013 Vicente Botet
+//
+// 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)
+
+#include <boost/thread/thread.hpp>
+#include <iostream>
+
+#include <iostream>
+
+#include <boost/thread.hpp>
+#include <boost/thread/locks.hpp>
+#include <boost/chrono.hpp>
+//#include <boost/bind.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+
+void do_thread()
+{
+
+ try
+ {
+ boost::condition_variable c1;
+ boost::mutex m1;
+ boost::unique_lock<boost::mutex> l1(m1);
+
+ c1.wait_for(l1, boost::chrono::seconds(1));
+ }
+ catch (std::runtime_error& ex)
+ {
+ std::cout << "EXCEPTION ! " << ex.what() << std::endl;
+ BOOST_TEST(false);
+
+ }
+ catch (...)
+ {
+ std::cout << "EXCEPTION ! " << std::endl;
+ BOOST_TEST(false);
+ }
+
+}
+
+int main()
+{
+
+ boost::thread th1(&do_thread);
+ th1.join();
+
+ //std::string s1;
+ //std::cin >> s1;
+
+ return boost::report_errors();
+}
Modified: branches/release/libs/thread/test/test_9079_b.cpp
==============================================================================
--- branches/release/libs/thread/test/test_9079_b.cpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/libs/thread/test/test_9079_b.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -8,6 +8,7 @@
#include <boost/atomic.hpp>
//#include <boost/log/trivial.hpp>
#include <boost/chrono.hpp>
+#include <boost/chrono/chrono_io.hpp>
#include <boost/thread.hpp>
#include <boost/thread/condition_variable.hpp>
@@ -59,7 +60,9 @@
//BOOST_LOG_TRIVIAL(info) << "[TaskScheduler::run_and_wait] Scheduling loop - BEGIN";
- while (!foo.is_exiting()) {
+ int i =11;
+ while (i--)
+ {
const TimePoint next_task_spawn_time = foo.spawn_tasks();
const TimePoint now = real_time_now();
@@ -71,6 +74,8 @@
const TimePoint::duration wait_time = next_spawn_time - now;
if (wait_time > wait_time.zero()) {
// BOOST_LOG_TRIVIAL(trace) << "WAIT TIME: " << wait_time; // UNCOMMENT THIS: MAKES IT WORKS. WAT??????
+ boost::this_thread::sleep_for(boost::chrono::seconds(1));
+ std::cout << next_spawn_time << std::endl;
m_task_spawn_condition.wait_until(
main_thread_lock,
next_spawn_time); // DON'T WORK: WILL WAIT IF next_spawn_time is too close!
Copied: branches/release/libs/thread/test/test_9192.cpp (from r86546, trunk/libs/thread/test/test_9192.cpp)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/libs/thread/test/test_9192.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770, copy of r86546, trunk/libs/thread/test/test_9192.cpp)
@@ -0,0 +1,140 @@
+#include <boost/interprocess/shared_memory_object.hpp>
+#include <boost/interprocess/mapped_region.hpp>
+#include <boost/thread.hpp>
+
+using namespace boost::interprocess;
+
+struct item
+{
+ int i;
+};
+
+struct queue
+{
+ void put( const item& item )
+ {
+ boost::unique_lock<boost::mutex> lock(mutex);
+ while ( item_in )
+ cond_full.wait(lock);
+
+ item_ = item;
+ item_in = true;
+ cond_empty.notify_one();
+ }
+
+ void print()
+ {
+ boost::unique_lock<boost::mutex> lock(mutex);
+ while ( !item_in )
+ cond_empty.wait(lock);
+
+ item_in = false;
+ std::cout << item_.i << std::endl;
+ cond_full.notify_one();
+ }
+
+
+private:
+ //Mutex to protect access to the queue
+ boost::mutex mutex;
+
+ //Condition to wait when the queue is empty
+ boost::condition_variable cond_empty;
+
+ //Condition to wait when the queue is full
+ boost::condition_variable cond_full;
+
+ bool item_in;
+
+ //Items to fill
+ item item_;
+};
+
+void *addr;
+
+void printThread()
+{
+ //Erase previous shared memory and schedule erasure on exit
+ struct shm_remove
+ {
+ shm_remove() { shared_memory_object::remove("MySharedMemory"); }
+ ~shm_remove(){ shared_memory_object::remove("MySharedMemory"); }
+ } remover;
+
+ //Create a shared memory object.
+ shared_memory_object shm(create_only,"MySharedMemory",read_write);
+
+ try
+ {
+// //Set size
+// shm.truncate(sizeof(queue));
+//
+// //Map the whole shared memory in this process
+// mapped_region region(shm,read_write);
+//
+// //Get the address of the mapped region
+// void *addr = region.get_address();
+
+ //Construct the shared structure in memory
+ queue *q = new (addr) queue;
+
+ do
+ {
+ q->print();
+ } while ( true );
+ }
+// catch(interprocess_exception &ex)
+// {
+// std::cout << ex.what() << std::endl;
+// }
+ catch(boost::thread_interrupted&)
+ {
+ std::cout << "interrupted" << std::endl;
+ }
+ catch(...)
+ {
+ std::cout << "exception" << std::endl;
+ }
+}
+
+int main()
+{
+ addr = new queue();
+ boost::thread t(printThread);
+
+ // give the thread time to create the shm
+ boost::this_thread::sleep( boost::posix_time::milliseconds( 1000 ) );
+
+// //Create a shared memory object.
+// shared_memory_object shm(open_only,"MySharedMemory",read_write);
+
+ try
+ {
+// //Map the whole shared memory in this process
+// mapped_region region(shm,read_write);
+//
+// //Get the address of the mapped region
+// void *addr = region.get_address();
+
+ //Obtain a pointer to the shared structure
+ queue *q = static_cast<queue*>(addr);
+
+ item i;
+ i.i = 42;
+ q->put( i );
+
+ ++i.i;
+ q->put( i );
+
+ // give the printThread time to "process" the item
+ boost::this_thread::sleep( boost::posix_time::milliseconds( 1000 ) );
+
+ t.interrupt();
+ t.join();
+ }
+ catch(...)
+ {
+ std::cout << "exception" << std::endl;
+ return -1;
+ }
+}
Copied: branches/release/libs/thread/test/test_9303.cpp (from r86594, trunk/libs/thread/test/test_9303.cpp)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/libs/thread/test/test_9303.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770, copy of r86594, trunk/libs/thread/test/test_9303.cpp)
@@ -0,0 +1,171 @@
+#define BOOST_THREAD_VERSION 4
+ #include <iostream>
+ #include <fstream>
+ #include <stdio.h>
+ #include <boost/function.hpp>
+ #include <boost/make_shared.hpp>
+ #include <boost/shared_ptr.hpp>
+ #include <boost/bind.hpp>
+ //#include <boost/asio.hpp>
+ #include <boost/thread.hpp>
+ #include <boost/thread/future.hpp>
+
+#if defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
+ #define EXAMPLE_1
+ #define EXAMPLE_2
+ #define EXAMPLE_3
+ //#define EXAMPLE_4
+ //#define EXAMPLE_5
+ //#define EXAMPLE_6
+ //#define EXAMPLE_7
+#else
+ #define EXAMPLE_1
+ #define EXAMPLE_2
+ //#define EXAMPLE_3
+ //#define EXAMPLE_4
+ //#define EXAMPLE_5
+ //#define EXAMPLE_6
+ //#define EXAMPLE_7
+#endif
+
+ // Test functions
+
+ int int_no_params()
+ {
+ return 42;
+ }
+
+ int int_with_params(int i)
+ {
+ return i;
+ }
+
+ std::string string_no_params()
+ {
+ return std::string("forty two");
+ }
+
+ std::string string_with_params(std::string& ans)
+ {
+ return ans;
+ }
+
+ int main(int /*argc*/, char ** /*argv[]*/)
+ {
+ std::string ans("forty two");
+
+ #if defined EXAMPLE_1
+ //! Compiles and produces correct result.
+ {
+ boost::packaged_task<int()> example(int_no_params);
+ boost::future<int> f = example.get_future();
+ boost::thread task(boost::move(example));
+ int answer = f.get();
+ std::cout << "Answer to life and whatnot, in English: " << answer << std::endl;
+ task.join();
+ }
+ #endif
+
+ #if defined EXAMPLE_2
+ //! Compiles and produces correct result.
+ {
+ boost::packaged_task<std::string()> example(string_no_params);
+ boost::future<std::string> f = example.get_future();
+ boost::thread task(boost::move(example));
+ std::string answer = f.get();
+ std::cout << "string_no_params: " << answer << std::endl;
+ task.join();
+ }
+
+ #endif
+
+ #if defined EXAMPLE_3
+ //! Doesn't compile in C++03.
+ //! error: variable âboost::packaged_task<std::basic_string<char>(std::basic_string<char>&)> exampleâ has initializer but incomplete type
+
+ {
+ boost::packaged_task<std::string(std::string&)> example(string_with_params);
+ boost::future<std::string> f = example.get_future();
+ example(ans);
+ std::string answer = f.get();
+ std::cout << "string_with_params: " << answer << std::endl;
+ }
+
+ #endif
+
+ #if defined EXAMPLE_4
+ //! Doesn't compile in C++11
+// In file included from test_9303.cpp:10:
+// In file included from ../../../boost/thread.hpp:13:
+// In file included from ../../../boost/thread/thread.hpp:12:
+// In file included from ../../../boost/thread/thread_only.hpp:22:
+// ../../../boost/thread/detail/thread.hpp:76:15: error: no matching function for call to 'invoke'
+// invoke(std::move(std::get<0>(fp)), std::move(std::get<Indices>(fp))...);
+// ^~~~~~
+
+ {
+ boost::packaged_task<std::string(std::string&)> example(string_with_params);
+ boost::future<std::string> f = example.get_future();
+ boost::thread task(boost::move(example), ans);
+ std::string answer = f.get();
+ std::cout << "string_with_params: " << answer << std::endl;
+ task.join();
+ }
+ #endif
+
+ #if defined EXAMPLE_5
+ //! Doesn't compile in C++03, C++11 only.
+ //! error: extended initializer lists only available with -std=c++11 or -std=gnu++11 [-Werror]
+ {
+ boost::packaged_task<std::string(std::string&)> example
+ { boost::bind(&string_with_params, ans) };
+ boost::future<std::string> f = example.get_future();
+ boost::thread task(boost::move(example), ans);
+ std::string answer = f.get();
+ std::cout << "string_with_params: " << answer << std::endl;
+ task.join();
+ }
+ #endif
+
+ #if defined EXAMPLE_6
+ //! Doesn't compile in C++03, C++11 only.
+ // packagedTestTest.cpp:94:43: error: invalid use of incomplete type âclass boost::packaged_task<std::basic_string<char>(std::basic_string<char>&)>â
+ // packagedTestTest.cpp:95:37: error: incomplete type âtask_t {aka boost::packaged_task<std::basic_string<char>(std::basic_string<char>&)>}â used in nested name specifier
+ // boost/thread/future.hpp:1320:11: error: declaration of âclass boost::packaged_task<std::basic_string<char>(std::basic_string<char>&)>â
+ {
+ typedef boost::packaged_task<std::string(std::string&)> task_t;
+ boost::shared_ptr<task_t> example = boost::make_shared<task_t>(boost::bind(&string_with_params, ans));
+ boost::future<std::string> f = example->get_future();
+ boost::thread task(boost::bind(&task_t::operator(), example));
+ std::string answer = f.get();
+ std::cout << "string_with_params: " << answer << std::endl;
+ task.join();
+ }
+ #endif
+
+ #if defined EXAMPLE_7
+ //! Doesn't compile in C++03, C++11 only.
+ // packagedTestTest.cpp:94:43: error: invalid use of incomplete type âclass boost::packaged_task<std::basic_string<char>(std::basic_string<char>&)>â
+ // packagedTestTest.cpp:95:37: error: incomplete type âtask_t {aka boost::packaged_task<std::basic_string<char>(std::basic_string<char>&)>}â used in nested name specifier
+ // boost/thread/future.hpp:1320:11: error: declaration of âclass boost::packaged_task<std::basic_string<char>(std::basic_string<char>&)>â
+ {
+ boost::asio::io_service io_service;
+ boost::thread_group threads;
+ boost::asio::io_service::work work(io_service);
+
+ for (int i = 0; i < 3; ++i)
+ {
+ threads.create_thread(boost::bind(&boost::asio::io_service::run,
+ &io_service));
+ }
+ typedef boost::packaged_task<std::string(std::string&)> task_t;
+ boost::shared_ptr<task_t> example = boost::make_shared<task_t>(boost::bind(&string_with_params, ans));
+ boost::future<std::string> f = example->get_future();
+ io_service.post(boost::bind(&task_t::operator(), example));
+ std::string answer = f.get();
+ std::cout << "string_with_params: " << answer << std::endl;
+ threads.join_all();
+ }
+ #endif
+ return 0;
+ }
Copied and modified: branches/release/libs/thread/test/test_9319.cpp (from r86546, trunk/libs/thread/test/test_9319.cpp)
==============================================================================
--- trunk/libs/thread/test/test_9319.cpp Sun Nov 3 10:08:19 2013 (r86546, copy source)
+++ branches/release/libs/thread/test/test_9319.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -14,9 +14,7 @@
#include <boost/shared_ptr.hpp>
#include <boost/scoped_ptr.hpp>
-using namespace boost;
-
-typedef shared_ptr< promise<int> > IntPromise;
+typedef boost::shared_ptr< boost::promise<int> > IntPromise;
void foo(IntPromise p)
{
@@ -24,7 +22,7 @@
p->set_value(123); // This line locks the future's mutex, then calls the continuation with the mutex already locked.
}
-void bar(future<int> fooResult)
+void bar(boost::future<int> fooResult)
{
std::cout << "bar" << std::endl;
int i = fooResult.get(); // Code hangs on this line (Due to future already being locked by the set_value call)
@@ -33,11 +31,11 @@
int main()
{
- IntPromise p(new promise<int>());
- thread t(boost::bind(foo, p));
- future<int> f1 = p->get_future();
+ IntPromise p(new boost::promise<int>());
+ boost::thread t(boost::bind(foo, p));
+ boost::future<int> f1 = p->get_future();
//f1.then(launch::deferred, boost::bind(bar, _1));
- f1.then(launch::deferred, &bar);
+ f1.then(boost::launch::deferred, &bar);
t.join();
}
Copied: branches/release/libs/thread/test/test_physical_concurrency.cpp (from r85961, trunk/libs/thread/test/test_physical_concurrency.cpp)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/libs/thread/test/test_physical_concurrency.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770, copy of r85961, trunk/libs/thread/test/test_physical_concurrency.cpp)
@@ -0,0 +1,24 @@
+// Copyright (C) 2007 Anthony Williams
+// Copyright (C) 2013 Tim Blechmann
+//
+// 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)
+#include <boost/thread/thread_only.hpp>
+#include <boost/test/unit_test.hpp>
+#include <boost/thread/mutex.hpp>
+
+void test_physical_concurrency_is_non_zero()
+{
+ BOOST_CHECK(boost::thread::physical_concurrency()!=0);
+}
+
+boost::unit_test::test_suite* init_unit_test_suite(int, char*[])
+{
+ boost::unit_test::test_suite* test =
+ BOOST_TEST_SUITE("Boost.Threads: physical concurrency test suite");
+
+ test->add(BOOST_TEST_CASE(test_physical_concurrency_is_non_zero));
+ return test;
+}
+
+
Modified: branches/release/libs/thread/test/threads/container/thread_ptr_list_pass.cpp
==============================================================================
--- branches/release/libs/thread/test/threads/container/thread_ptr_list_pass.cpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/libs/thread/test/threads/container/thread_ptr_list_pass.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -8,7 +8,7 @@
#include <boost/config.hpp>
#include <boost/thread/thread.hpp>
#include <boost/thread/mutex.hpp>
-#include <boost/container/list.hpp>
+#include <boost/thread/csbl/list.hpp>
//#include <boost/interprocess/smart_ptr/shared_ptr.hpp>
#include <boost/smart_ptr.hpp>
#include <iostream>
@@ -58,7 +58,7 @@
{
typedef boost::shared_ptr<boost::thread > thread_ptr;
//typedef boost::interprocess::shared_ptr<boost::thread, std::allocator<boost::thread>, default_delete<boost::thread> > thread_ptr;
- typedef boost::container::list<thread_ptr > thread_ptr_list;
+ typedef boost::csbl::list<thread_ptr > thread_ptr_list;
thread_ptr_list threads;
for (int i = 0; i < 10; ++i)
{
@@ -76,7 +76,7 @@
{
typedef boost::shared_ptr<boost::thread > thread_ptr;
//typedef boost::interprocess::shared_ptr<boost::thread, std::allocator<boost::thread>, default_delete<boost::thread> > thread_ptr;
- typedef boost::container::list<thread_ptr > thread_ptr_list;
+ typedef boost::csbl::list<thread_ptr > thread_ptr_list;
thread_ptr_list threads;
for (int i = 0; i < 10; ++i)
{
Modified: branches/release/libs/thread/test/threads/container/thread_vector_pass.cpp
==============================================================================
--- branches/release/libs/thread/test/threads/container/thread_vector_pass.cpp Tue Nov 19 16:12:50 2013 (r86769)
+++ branches/release/libs/thread/test/threads/container/thread_vector_pass.cpp 2013-11-19 16:58:34 EST (Tue, 19 Nov 2013) (r86770)
@@ -7,7 +7,7 @@
#include <boost/thread/thread.hpp>
#include <boost/thread/mutex.hpp>
-#include <boost/container/vector.hpp>
+#include <boost/thread/csbl/vector.hpp>
#include <iostream>
#include <boost/detail/lightweight_test.hpp>
#include <boost/static_assert.hpp>
@@ -50,7 +50,7 @@
int main()
{
- typedef boost::container::vector<boost::thread> thread_vector;
+ typedef boost::csbl::vector<boost::thread> thread_vector;
{
thread_vector threads;
threads.reserve(10);
@@ -92,5 +92,6 @@
interrupt_all(threads);
join_all(threads);
}
+
return boost::report_errors();
}
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