Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84979 - trunk/libs/thread/example
From: vicente.botet_at_[hidden]
Date: 2013-07-07 16:44:02


Author: viboes
Date: 2013-07-07 16:44:02 EDT (Sun, 07 Jul 2013)
New Revision: 84979
URL: http://svn.boost.org/trac/boost/changeset/84979

Log:
Thread: fix issue with continuation's future parameter which must taken by value.

Text files modified:
   trunk/libs/thread/example/future_then.cpp | 4 ++--
   trunk/libs/thread/example/lambda_future.cpp | 2 +-
   trunk/libs/thread/example/tennis.cpp | 3 +++
   3 files changed, 6 insertions(+), 3 deletions(-)

Modified: trunk/libs/thread/example/future_then.cpp
==============================================================================
--- trunk/libs/thread/example/future_then.cpp Sun Jul 7 16:36:05 2013 (r84978)
+++ trunk/libs/thread/example/future_then.cpp 2013-07-07 16:44:02 EDT (Sun, 07 Jul 2013) (r84979)
@@ -19,7 +19,7 @@
   return 123;
 }
 
-int p2(boost::future<int>& f)
+int p2(boost::future<int> f)
 {
   BOOST_THREAD_LOG << "<P2" << BOOST_THREAD_END_LOG;
   try
@@ -38,7 +38,7 @@
   }
   BOOST_THREAD_LOG << "P2>" << BOOST_THREAD_END_LOG;
 }
-int p2s(boost::shared_future<int>& f)
+int p2s(boost::shared_future<int> f)
 {
   BOOST_THREAD_LOG << "<P2" << BOOST_THREAD_END_LOG;
   try

Modified: trunk/libs/thread/example/lambda_future.cpp
==============================================================================
--- trunk/libs/thread/example/lambda_future.cpp Sun Jul 7 16:36:05 2013 (r84978)
+++ trunk/libs/thread/example/lambda_future.cpp 2013-07-07 16:44:02 EDT (Sun, 07 Jul 2013) (r84979)
@@ -33,7 +33,7 @@
     }
     {
       boost::future<int> f1 = boost::async(boost::launch::async, []() {return 123;});
- boost::future<int> f2 = f1.then([](boost::future<int>& f) {return 2*f.get(); });
+ boost::future<int> f2 = f1.then([](boost::future<int> f) {return 2*f.get(); });
       int result = f2.get();
       BOOST_THREAD_LOG << "f2 " << result << BOOST_THREAD_END_LOG;
     }

Modified: trunk/libs/thread/example/tennis.cpp
==============================================================================
--- trunk/libs/thread/example/tennis.cpp Sun Jul 7 16:36:05 2013 (r84978)
+++ trunk/libs/thread/example/tennis.cpp 2013-07-07 16:44:02 EDT (Sun, 07 Jul 2013) (r84979)
@@ -4,6 +4,9 @@
 // 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)
 
+#undef BOOST_THREAD_VERSION
+#define BOOST_THREAD_VERSION 2
+
 #include <boost/thread/mutex.hpp>
 #include <boost/thread/condition.hpp>
 #include <boost/thread/thread_only.hpp>


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