Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:34:38

0001 //---------------------------------------------------------------------------//
0002 // Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com>
0003 //
0004 // Distributed under the Boost Software License, Version 1.0
0005 // See accompanying file LICENSE_1_0.txt or copy at
0006 // http://www.boost.org/LICENSE_1_0.txt
0007 //
0008 // See http://boostorg.github.com/compute for more information.
0009 //---------------------------------------------------------------------------//
0010 
0011 #ifndef BOOST_COMPUTE_ASYNC_WAIT_HPP
0012 #define BOOST_COMPUTE_ASYNC_WAIT_HPP
0013 
0014 #include <boost/compute/config.hpp>
0015 #include <boost/compute/utility/wait_list.hpp>
0016 
0017 namespace boost {
0018 namespace compute {
0019 namespace detail {
0020 
0021 #ifndef BOOST_COMPUTE_NO_VARIADIC_TEMPLATES
0022 template<class Event>
0023 inline void insert_events_variadic(wait_list &l, Event&& event)
0024 {
0025     l.insert(std::forward<Event>(event));
0026 }
0027 
0028 template<class Event, class... Rest>
0029 inline void insert_events_variadic(wait_list &l, Event&& event, Rest&&... rest)
0030 {
0031     l.insert(std::forward<Event>(event));
0032 
0033     insert_events_variadic(l, std::forward<Rest>(rest)...);
0034 }
0035 #endif // BOOST_COMPUTE_NO_VARIADIC_TEMPLATES
0036 
0037 } // end detail namespace
0038 
0039 #ifndef BOOST_COMPUTE_NO_VARIADIC_TEMPLATES
0040 /// Blocks until all events have completed. Events can either be \ref event
0041 /// objects or \ref future "future<T>" objects.
0042 ///
0043 /// \see event, wait_list
0044 template<class... Events>
0045 inline void wait_for_all(Events&&... events)
0046 {
0047     wait_list l;
0048     detail::insert_events_variadic(l, std::forward<Events>(events)...);
0049     l.wait();
0050 }
0051 #endif // BOOST_COMPUTE_NO_VARIADIC_TEMPLATES
0052 
0053 } // end compute namespace
0054 } // end boost namespace
0055 
0056 #endif // BOOST_COMPUTE_ASYNC_WAIT_HPP