1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com>
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
8 // See http://boostorg.github.com/compute for more information.
9 //---------------------------------------------------------------------------//
11 #ifndef BOOST_COMPUTE_ASYNC_WAIT_HPP
12 #define BOOST_COMPUTE_ASYNC_WAIT_HPP
14 #include <boost/compute/config.hpp>
15 #include <boost/compute/utility/wait_list.hpp>
21 #ifndef BOOST_COMPUTE_NO_VARIADIC_TEMPLATES
23 inline void insert_events_variadic(wait_list &l, Event&& event)
25 l.insert(std::forward<Event>(event));
28 template<class Event, class... Rest>
29 inline void insert_events_variadic(wait_list &l, Event&& event, Rest&&... rest)
31 l.insert(std::forward<Event>(event));
33 insert_events_variadic(l, std::forward<Rest>(rest)...);
35 #endif // BOOST_COMPUTE_NO_VARIADIC_TEMPLATES
37 } // end detail namespace
39 #ifndef BOOST_COMPUTE_NO_VARIADIC_TEMPLATES
40 /// Blocks until all events have completed. Events can either be \ref event
41 /// objects or \ref future "future<T>" objects.
43 /// \see event, wait_list
44 template<class... Events>
45 inline void wait_for_all(Events&&... events)
48 detail::insert_events_variadic(l, std::forward<Events>(events)...);
51 #endif // BOOST_COMPUTE_NO_VARIADIC_TEMPLATES
53 } // end compute namespace
54 } // end boost namespace
56 #endif // BOOST_COMPUTE_ASYNC_WAIT_HPP