Add spawn overload that just takes a function without a handler or executor.
This commit is contained in:
parent
c1d4653363
commit
0372cdda34
@ -325,6 +325,18 @@ namespace detail {
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <typename Function>
|
||||
inline void spawn(ASIO_MOVE_ARG(Function) function,
|
||||
const boost::coroutines::attributes& attributes)
|
||||
{
|
||||
typedef typename decay<Function>::type function_type;
|
||||
|
||||
typename associated_executor<function_type>::type ex(
|
||||
(get_associated_executor)(function));
|
||||
|
||||
asio::spawn(ex, ASIO_MOVE_CAST(Function)(function), attributes);
|
||||
}
|
||||
|
||||
template <typename Handler, typename Function>
|
||||
void spawn(ASIO_MOVE_ARG(Handler) handler,
|
||||
ASIO_MOVE_ARG(Function) function,
|
||||
|
@ -190,6 +190,21 @@ typedef basic_yield_context<
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
/// Start a new stackful coroutine, calling the specified handler when it
|
||||
/// completes.
|
||||
/**
|
||||
* This function is used to launch a new coroutine.
|
||||
*
|
||||
* @param function The coroutine function. The function must have the signature:
|
||||
* @code void function(basic_yield_context<Handler> yield); @endcode
|
||||
*
|
||||
* @param attributes Boost.Coroutine attributes used to customise the coroutine.
|
||||
*/
|
||||
template <typename Function>
|
||||
void spawn(ASIO_MOVE_ARG(Function) function,
|
||||
const boost::coroutines::attributes& attributes
|
||||
= boost::coroutines::attributes());
|
||||
|
||||
/// Start a new stackful coroutine, calling the specified handler when it
|
||||
/// completes.
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user