|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r86586 - in trunk: boost/thread libs/thread/example
From: vicente.botet_at_[hidden]
Date: 2013-11-08 12:51:39
Author: viboes
Date: 2013-11-08 12:51:39 EST (Fri, 08 Nov 2013)
New Revision: 86586
URL: http://svn.boost.org/trac/boost/changeset/86586
Log:
Thread: Added caller_context.hpp; Change executor by Executor template parameter in async; update the number of time the failing tests are run to catch all the compilers.
Added:
trunk/boost/thread/caller_context.hpp (contents, props changed)
Text files modified:
trunk/boost/thread/caller_context.hpp | 55 ++++++++++++++++++++++++++++++++++++
trunk/boost/thread/executor.hpp | 53 ++++++++++++++++++++++++++++++++-
trunk/boost/thread/future.hpp | 61 +++++++++++++++++----------------------
trunk/boost/thread/ostream_buffer.hpp | 16 ++++++++-
trunk/libs/thread/example/executor.cpp | 56 ++++++++++++++++++++++++++---------
trunk/libs/thread/example/future_fallback_to.cpp | 13 ++++++-
trunk/libs/thread/example/future_then.cpp | 9 +++-
trunk/libs/thread/example/future_unwrap.cpp | 7 +++-
trunk/libs/thread/example/lambda_future.cpp | 8 +++-
trunk/libs/thread/example/make_future.cpp | 3 +
10 files changed, 215 insertions(+), 66 deletions(-)
Added: trunk/boost/thread/caller_context.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/boost/thread/caller_context.hpp 2013-11-08 12:51:39 EST (Fri, 08 Nov 2013) (r86586)
@@ -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: trunk/boost/thread/executor.hpp
==============================================================================
--- trunk/boost/thread/executor.hpp Fri Nov 8 03:16:21 2013 (r86585)
+++ trunk/boost/thread/executor.hpp 2013-11-08 12:51:39 EST (Fri, 08 Nov 2013) (r86586)
@@ -142,7 +142,32 @@
executor_adaptor(BOOST_THREAD_RV_REF(Args) ... args) : ex(boost::forward<Args>(args)...) {}
#else
template <typename A1>
- executor_adaptor(BOOST_THREAD_FWD_REF(A1) a1) : ex(boost::forward<A1>(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; }
@@ -166,8 +191,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: trunk/boost/thread/future.hpp
==============================================================================
--- trunk/boost/thread/future.hpp Fri Nov 8 03:16:21 2013 (r86585)
+++ trunk/boost/thread/future.hpp 2013-11-08 12:51:39 EST (Fri, 08 Nov 2013) (r86586)
@@ -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,6 @@
#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>
@@ -69,10 +66,6 @@
#include <boost/thread/csbl/vector.hpp>
#endif
-#ifdef BOOST_THREAD_PROVIDES_EXECUTORS
-#include <boost/thread/executor.hpp>
-#endif
-
#if defined BOOST_THREAD_PROVIDES_FUTURE
#define BOOST_THREAD_FUTURE future
#else
@@ -3712,20 +3705,20 @@
/////////////////////////
/// future_executor_shared_state_base
/////////////////////////
- template<typename Rp>
+ template<typename Rp, typename Executor>
struct future_executor_shared_state: shared_state<Rp>
{
typedef shared_state<Rp> base_type;
protected:
- boost::executor& ex_;
+ //Executor& ex_;
public:
template<typename Fp>
- future_executor_shared_state(boost::executor& ex, BOOST_THREAD_FWD_REF(Fp) f)
- : ex_(ex)
+ 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));
+ ex.submit(boost::move(t));
}
~future_executor_shared_state()
@@ -3737,28 +3730,28 @@
////////////////////////////////
// make_future_executor_shared_state
////////////////////////////////
- template <class Rp, class Fp>
+ template <class Rp, class Fp, class Executor>
BOOST_THREAD_FUTURE<Rp>
- make_future_executor_shared_state(executor& ex, BOOST_THREAD_FWD_REF(Fp) f)
+ make_future_executor_shared_state(Executor& ex, BOOST_THREAD_FWD_REF(Fp) f)
{
- shared_ptr<future_executor_shared_state<Rp> >
- h(new future_executor_shared_state<Rp>(ex, boost::forward<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 F, class... ArgTypes>
- // future<R> async(executor& ex, F&&, ArgTypes&&...);
+ // 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 R, class... ArgTypes>
+ 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)
+ 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;
@@ -3773,11 +3766,11 @@
}
#endif // defined BOOST_THREAD_RVALUE_REFERENCES_DONT_MATCH_FUNTION_PTR
- template <class F, class ...ArgTypes>
+ 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)
+ 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;
@@ -3792,41 +3785,41 @@
#else // ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#if defined BOOST_THREAD_RVALUE_REFERENCES_DONT_MATCH_FUNTION_PTR
- template <class R>
+ template <class Executor, class R>
BOOST_THREAD_FUTURE<R>
- async(executor& ex, R(*f)())
+ async(Executor& ex, R(*f)())
{
typedef R(*F)();
- typedef detail::async_func<typename decay<F>::type> BF;
+ 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(
- thread_detail::decay_copy(boost::forward<F>(f))
+ f
)
));
}
- template <class R, class A1>
+ 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)
+ 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<typename decay<F>::type, typename decay<A1>::type> BF;
+ 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(
- thread_detail::decay_copy(boost::forward<F>(f))
+ f
, thread_detail::decay_copy(boost::forward<A1>(a1))
)
));
}
#endif // defined BOOST_THREAD_RVALUE_REFERENCES_DONT_MATCH_FUNTION_PTR
- template <class F>
+ 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)
+ async(Executor& ex, BOOST_THREAD_FWD_REF(F) f)
{
typedef detail::async_func<typename decay<F>::type> BF;
typedef typename BF::result_type Rp;
@@ -3838,11 +3831,11 @@
);
}
- template <class F, class A1>
+ 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)
+ 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;
Modified: trunk/boost/thread/ostream_buffer.hpp
==============================================================================
--- trunk/boost/thread/ostream_buffer.hpp Fri Nov 8 03:16:21 2013 (r86585)
+++ trunk/boost/thread/ostream_buffer.hpp 2013-11-08 12:51:39 EST (Fri, 08 Nov 2013) (r86586)
@@ -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: trunk/libs/thread/example/executor.cpp
==============================================================================
--- trunk/libs/thread/example/executor.cpp Fri Nov 8 03:16:21 2013 (r86585)
+++ trunk/libs/thread/example/executor.cpp 2013-11-08 12:51:39 EST (Fri, 08 Nov 2013) (r86586)
@@ -4,29 +4,42 @@
// 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
-#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 submit_some(boost::executor& tp) {
+int f1()
+{
+ std::cout << BOOST_CONTEXTOF << std::endl;
+ boost::this_thread::sleep_for(boost::chrono::seconds(1));
+ return 1;
+}
+int f2(int i)
+{
+ std::cout << BOOST_CONTEXTOF << std::endl;
+ boost::this_thread::sleep_for(boost::chrono::seconds(2));
+ return i + 1;
+}
+
+void submit_some(boost::executor& tp)
+{
tp.submit(&p1);
tp.submit(&p2);
tp.submit(&p1);
@@ -41,13 +54,29 @@
int main()
{
- BOOST_THREAD_LOG
- << boost::this_thread::get_id() << " <MAIN" << BOOST_THREAD_END_LOG;
+ std::cout << BOOST_CONTEXTOF << std::endl;
{
try
{
boost::executor_adaptor<boost::thread_pool> ea;
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);
@@ -56,18 +85,15 @@
}
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;
}
}
- BOOST_THREAD_LOG
- << boost::this_thread::get_id() << "MAIN>" << BOOST_THREAD_END_LOG;
+ std::cout << BOOST_CONTEXTOF << std::endl;
return 0;
}
Modified: trunk/libs/thread/example/future_fallback_to.cpp
==============================================================================
--- trunk/libs/thread/example/future_fallback_to.cpp Fri Nov 8 03:16:21 2013 (r86585)
+++ trunk/libs/thread/example/future_fallback_to.cpp 2013-11-08 12:51:39 EST (Fri, 08 Nov 2013) (r86586)
@@ -4,7 +4,7 @@
// 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
#define BOOST_THREAD_USES_LOG_THREAD_ID
#include <boost/thread/detail/log.hpp>
@@ -12,6 +12,7 @@
#include <boost/assert.hpp>
#include <exception>
#include <string>
+#include <iostream>
#if defined BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION
@@ -29,9 +30,10 @@
int main()
{
+ const int number_of_tests = 100;
BOOST_THREAD_LOG << "<MAIN" << BOOST_THREAD_END_LOG;
{
- for (int i=0; i< 100; i++)
+ for (int i=0; i< number_of_tests; i++)
try
{
//boost::future<int> f1 = boost::async(boost::launch::async, &p1);
@@ -45,17 +47,20 @@
}
catch (std::exception& ex)
{
+ std::cout << "ERRORRRRR "<<ex.what() << "" << std::endl;
BOOST_THREAD_LOG << "ERRORRRRR "<<ex.what() << "" << BOOST_THREAD_END_LOG;
return 1;
}
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< 100; i++)
+ for (int i=0; i< number_of_tests; i++)
try
{
BOOST_THREAD_LOG << "" << BOOST_THREAD_END_LOG;
@@ -68,11 +73,13 @@
}
catch (std::exception& ex)
{
+ std::cout << "ERRORRRRR "<<ex.what() << "" << std::endl;
BOOST_THREAD_LOG << "ERRORRRRR "<<ex.what() << "" << BOOST_THREAD_END_LOG;
return 1;
}
catch (...)
{
+ std::cout << " ERRORRRRR exception thrown" << std::endl;
BOOST_THREAD_LOG << " ERRORRRRR exception thrown" << BOOST_THREAD_END_LOG;
return 2;
}
Modified: trunk/libs/thread/example/future_then.cpp
==============================================================================
--- trunk/libs/thread/example/future_then.cpp Fri Nov 8 03:16:21 2013 (r86585)
+++ trunk/libs/thread/example/future_then.cpp 2013-11-08 12:51:39 EST (Fri, 08 Nov 2013) (r86586)
@@ -4,7 +4,7 @@
// 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
#define BOOST_THREAD_USES_LOG_THREAD_ID
#include <boost/thread/detail/log.hpp>
@@ -28,6 +28,7 @@
}
catch (std::exception& ex)
{
+ std::cout << "ERRORRRRR "<<ex.what() << "" << std::endl;
BOOST_THREAD_LOG << "ERRORRRRR "<<ex.what() << "" << BOOST_THREAD_END_LOG;
BOOST_ASSERT(false);
}
@@ -47,6 +48,7 @@
}
catch (std::exception& ex)
{
+ std::cout << "ERRORRRRR "<<ex.what() << "" << std::endl;
BOOST_THREAD_LOG << "ERRORRRRR "<<ex.what() << "" << BOOST_THREAD_END_LOG;
BOOST_ASSERT(false);
}
@@ -60,9 +62,10 @@
int main()
{
+ const int number_of_tests = 100;
BOOST_THREAD_LOG << "<MAIN" << BOOST_THREAD_END_LOG;
{
- for (int i=0; i< 10; i++)
+ for (int i=0; i< number_of_tests; i++)
try
{
BOOST_THREAD_LOG << "" << BOOST_THREAD_END_LOG;
@@ -86,7 +89,7 @@
}
}
{
- for (int i=0; i< 10; i++)
+ for (int i=0; i< number_of_tests; i++)
try
{
BOOST_THREAD_LOG << "" << BOOST_THREAD_END_LOG;
Modified: trunk/libs/thread/example/future_unwrap.cpp
==============================================================================
--- trunk/libs/thread/example/future_unwrap.cpp Fri Nov 8 03:16:21 2013 (r86585)
+++ trunk/libs/thread/example/future_unwrap.cpp 2013-11-08 12:51:39 EST (Fri, 08 Nov 2013) (r86586)
@@ -4,7 +4,7 @@
// 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
#define BOOST_THREAD_USES_LOG_THREAD_ID
#include <boost/thread/detail/log.hpp>
@@ -29,8 +29,9 @@
int main()
{
+ const int number_of_tests = 100;
BOOST_THREAD_LOG << "<MAIN" << BOOST_THREAD_END_LOG;
- for (int i=0; i< 10; i++)
+ for (int i=0; i< number_of_tests; i++)
try
{
boost::future<boost::future<int> > outer_future = boost::async(boost::launch::async, &p2);
@@ -40,11 +41,13 @@
}
catch (std::exception& ex)
{
+ std::cout << "ERRORRRRR "<<ex.what() << "" << std::endl;
BOOST_THREAD_LOG << "ERRORRRRR "<<ex.what() << "" << BOOST_THREAD_END_LOG;
return 1;
}
catch (...)
{
+ std::cout << " ERRORRRRR exception thrown" << std::endl;
BOOST_THREAD_LOG << " ERRORRRRR exception thrown" << BOOST_THREAD_END_LOG;
return 2;
}
Modified: trunk/libs/thread/example/lambda_future.cpp
==============================================================================
--- trunk/libs/thread/example/lambda_future.cpp Fri Nov 8 03:16:21 2013 (r86585)
+++ trunk/libs/thread/example/lambda_future.cpp 2013-11-08 12:51:39 EST (Fri, 08 Nov 2013) (r86586)
@@ -9,7 +9,7 @@
#define BOOST_RESULT_OF_USE_DECLTYPE
#endif
#define BOOST_THREAD_VERSION 4
-#define BOOST_THREAD_USES_LOG
+//#define BOOST_THREAD_USES_LOG
#define BOOST_THREAD_USES_LOG_THREAD_ID
#include <boost/thread/detail/log.hpp>
@@ -20,11 +20,13 @@
#if defined BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION \
&& ! defined BOOST_NO_CXX11_LAMBDAS
+
int main()
{
+ const int number_of_tests = 100;
BOOST_THREAD_LOG << "<MAIN" << BOOST_THREAD_END_LOG;
- for (int i=0; i< 10; i++)
+ for (int i=0; i< number_of_tests; i++)
try
{
{
@@ -41,11 +43,13 @@
}
catch (std::exception& ex)
{
+ std::cout << "ERRORRRRR "<<ex.what() << "" << std::endl;
BOOST_THREAD_LOG << "ERRORRRRR "<<ex.what() << "" << BOOST_THREAD_END_LOG;
return 1;
}
catch (...)
{
+ std::cout << " ERRORRRRR exception thrown" << std::endl;
BOOST_THREAD_LOG << " ERRORRRRR exception thrown" << BOOST_THREAD_END_LOG;
return 2;
}
Modified: trunk/libs/thread/example/make_future.cpp
==============================================================================
--- trunk/libs/thread/example/make_future.cpp Fri Nov 8 03:16:21 2013 (r86585)
+++ trunk/libs/thread/example/make_future.cpp 2013-11-08 12:51:39 EST (Fri, 08 Nov 2013) (r86586)
@@ -51,7 +51,8 @@
int main()
{
- for (int i=0; i< 10; i++)
+ const int number_of_tests = 100;
+ for (int i=0; i< number_of_tests; i++)
try
{
#if defined BOOST_THREAD_USES_MOVE
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