Implementing a Rudimentary Task Type (Part 2)

Learn how to resume an awaiting coroutine and support void tasks.

Resuming an awaiting coroutine

When the asynchronous task has been completed, it should transfer the control back to the coroutine, waiting for the task to finish. To resume this continuation, the Task object needs the coroutine_handle to the continuation coroutine. This handle was passed to the Task object’s await_suspend() function, and conveniently we made sure to save that handle into the promise object:

Get hands-on with 1200+ tech skills courses.