Start a new stackful coroutine, inheriting the executor of another.
template< typename Executor, typename StackAllocator, typename F, typename CompletionToken = DEFAULT> DEDUCED spawn( const basic_yield_context< Executor > & ctx, allocator_arg_t , StackAllocator && stack_allocator, F && function, CompletionToken && token = DEFAULT, typename constraint< is_executor< Executor >::value||execution::is_executor< Executor >::value >::type = 0);
This function is used to launch a new stackful coroutine using the specified stack allocator.
Identifies the current coroutine as a parent of the new coroutine. This specifies that the new coroutine should inherit the executor of the parent. For example, if the parent coroutine is executing in a particular strand, then the new coroutine will execute in the same strand.
Denotes the allocator to be used to allocate the underlying coroutine's stack. The type must satisfy the stack-allocator concept defined by the Boost.Context library.
The coroutine function. The function must be callable the signature:
void function(basic_yield_context<Executor> yield);
token that will handle the notification that the coroutine
has completed. If the return type
void, the function signature of the
completion handler must be:
Otherwise, the function signature of the completion handler must be:
void handler(std::exception_ptr, R);
R is the return type
of the function object.
The new thread of execution is created with a cancellation state that supports
cancellation_type::terminal values only. To change the cancellation
state, call the
basic_yield_context member function