// // co_spawn.hpp // ~~~~~~~~~~~~ // // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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_ASIO_CO_SPAWN_HPP #define BOOST_ASIO_CO_SPAWN_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include #if defined(BOOST_ASIO_HAS_CO_AWAIT) || defined(GENERATING_DOCUMENTATION) #include #include #include #include namespace boost { namespace asio { namespace detail { template struct awaitable_signature; template struct awaitable_signature> { typedef void type(std::exception_ptr, T); }; template struct awaitable_signature> { typedef void type(std::exception_ptr); }; } // namespace detail /// Spawn a new thread of execution. /** * The entry point function object @c f must have the signature: * * @code awaitable f(); @endcode * * where @c E is convertible from @c Executor. */ template ::type>::type) CompletionToken BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(Executor)> BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, typename detail::awaitable_signature::type>::type) co_spawn(const Executor& ex, F&& f, CompletionToken&& token BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(Executor), typename enable_if< is_executor::value >::type* = 0); /// Spawn a new thread of execution. /** * The entry point function object @c f must have the signature: * * @code awaitable f(); @endcode * * where @c E is convertible from @c ExecutionContext::executor_type. */ template ::type>::type) CompletionToken BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE( typename ExecutionContext::executor_type)> BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, typename detail::awaitable_signature::type>::type) co_spawn(ExecutionContext& ctx, F&& f, CompletionToken&& token BOOST_ASIO_DEFAULT_COMPLETION_TOKEN( typename ExecutionContext::executor_type), typename enable_if< is_convertible::value >::type* = 0); } // namespace asio } // namespace boost #include #include #endif // defined(BOOST_ASIO_HAS_CO_AWAIT) || defined(GENERATING_DOCUMENTATION) #endif // BOOST_ASIO_CO_SPAWN_HPP