Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:52:47

0001 //  (C) Copyright 2008-10 Anthony Williams
0002 //  (C) Copyright 2011-2015 Vicente J. Botet Escriba
0003 //
0004 //  Distributed under the Boost Software License, Version 1.0. (See
0005 //  accompanying file LICENSE_1_0.txt or copy at
0006 //  http://www.boost.org/LICENSE_1_0.txt)
0007 
0008 #ifndef BOOST_THREAD_FUTURES_WAIT_FOR_ALL_HPP
0009 #define BOOST_THREAD_FUTURES_WAIT_FOR_ALL_HPP
0010 
0011 #include <boost/thread/detail/config.hpp>
0012 #include <boost/thread/futures/is_future_type.hpp>
0013 
0014 #include <boost/core/enable_if.hpp>
0015 
0016 namespace boost
0017 {
0018   template<typename Iterator>
0019   typename boost::disable_if<is_future_type<Iterator>,void>::type wait_for_all(Iterator begin,Iterator end)
0020   {
0021       for(Iterator current=begin;current!=end;++current)
0022       {
0023           current->wait();
0024       }
0025   }
0026 
0027 #ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES
0028     template<typename F1,typename F2>
0029     typename boost::enable_if<is_future_type<F1>,void>::type wait_for_all(F1& f1,F2& f2)
0030     {
0031         f1.wait();
0032         f2.wait();
0033     }
0034 
0035     template<typename F1,typename F2,typename F3>
0036     void wait_for_all(F1& f1,F2& f2,F3& f3)
0037     {
0038         f1.wait();
0039         f2.wait();
0040         f3.wait();
0041     }
0042 
0043     template<typename F1,typename F2,typename F3,typename F4>
0044     void wait_for_all(F1& f1,F2& f2,F3& f3,F4& f4)
0045     {
0046         f1.wait();
0047         f2.wait();
0048         f3.wait();
0049         f4.wait();
0050     }
0051 
0052     template<typename F1,typename F2,typename F3,typename F4,typename F5>
0053     void wait_for_all(F1& f1,F2& f2,F3& f3,F4& f4,F5& f5)
0054     {
0055         f1.wait();
0056         f2.wait();
0057         f3.wait();
0058         f4.wait();
0059         f5.wait();
0060     }
0061 #else
0062     template<typename F1, typename... Fs>
0063     typename boost::enable_if<is_future_type<F1>,void>::type wait_for_all(F1& f1, Fs&... fs)
0064     {
0065         bool dummy[] = { (f1.wait(), true), (fs.wait(), true)... };
0066 
0067         // prevent unused parameter warning
0068         (void) dummy;
0069     }
0070 #endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)}
0071 
0072 }
0073 
0074 #endif // header