Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r63790 - in trunk: boost/thread libs/thread/test
From: anthony_at_[hidden]
Date: 2010-07-09 15:18:17


Author: anthonyw
Date: 2010-07-09 15:18:16 EDT (Fri, 09 Jul 2010)
New Revision: 63790
URL: http://svn.boost.org/trac/boost/changeset/63790

Log:
Fix for issue #4413 --- allow wait_for_any to work with empty ranges
Text files modified:
   trunk/boost/thread/future.hpp | 3 +++
   trunk/libs/thread/test/test_futures.cpp | 2 ++
   2 files changed, 5 insertions(+), 0 deletions(-)

Modified: trunk/boost/thread/future.hpp
==============================================================================
--- trunk/boost/thread/future.hpp (original)
+++ trunk/boost/thread/future.hpp 2010-07-09 15:18:16 EDT (Fri, 09 Jul 2010)
@@ -554,6 +554,9 @@
     template<typename Iterator>
     typename boost::disable_if<is_future_type<Iterator>,Iterator>::type wait_for_any(Iterator begin,Iterator end)
     {
+ if(begin==end)
+ return end;
+
         detail::future_waiter waiter;
         for(Iterator current=begin;current!=end;++current)
         {

Modified: trunk/libs/thread/test/test_futures.cpp
==============================================================================
--- trunk/libs/thread/test/test_futures.cpp (original)
+++ trunk/libs/thread/test/test_futures.cpp 2010-07-09 15:18:16 EDT (Fri, 09 Jul 2010)
@@ -1041,6 +1041,8 @@
         }
         boost::thread(::cast_to_rval(tasks[i]));
     
+ BOOST_CHECK(boost::wait_for_any(futures,futures)==futures);
+
         boost::unique_future<int>* const future=boost::wait_for_any(futures,futures+count);
     
         BOOST_CHECK(future==(futures+i));


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