// // Copyright (c) 2022 Klemens Morgenstern (klemens.morgenstern@gmx.net) // // 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) // #ifndef BOOST_COBALT_SPAWN_HPP #define BOOST_COBALT_SPAWN_HPP #include namespace boost::cobalt { template auto spawn(Context & context, task && t, CompletionToken&& token) { return asio::async_initiate( detail::async_initiate_spawn{context.get_executor()}, token, std::move(t)); } template Executor, typename T, typename CompletionToken> auto spawn(Executor executor, task && t, CompletionToken&& token BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(Executor)) { return asio::async_initiate( detail::async_initiate_spawn{executor}, token, std::move(t)); } template auto spawn(Context & context, task && t, CompletionToken&& token) { return asio::async_initiate( detail::async_initiate_spawn{context.get_executor()}, token, std::move(t)); } template Executor, typename CompletionToken> auto spawn(Executor executor, task && t, CompletionToken&& token BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(Executor)) { return asio::async_initiate( detail::async_initiate_spawn{executor}, token, std::move(t)); } } #endif //BOOST_COBALT_SPAWN_HPP