tmc::spawn()

tmc::spawn()#

spawn() produces a task wrapper that exposes several customization functions that allow you to control where an awaitable runs and how the awaiting task is resumed.

By itself, spawn() doesn’t do anything different than just awaiting directly. Its only purpose is to allow customization.

It supports these Awaitable Customizations: run_on(), resume_on(), with_priority(), co_await, fork(), detach()

API Reference#

template<typename Awaitable>
aw_spawn<tmc::detail::forward_awaitable<Awaitable>> tmc::spawn(Awaitable &&Task)#

spawn() allows you to customize the execution behavior of a task or awaitable.

Before the task is submitted for execution, you may call any or all of run_on(), resume_on(), with_priority(). The task must then be submitted for execution by calling exactly one of: co_await, fork() or detach().