Implementing a Rudimentary Task Type (Part 2)
Learn how to resume an awaiting coroutine and support void tasks.
We'll cover the following...
We'll cover the following...
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:
The final_suspend() function is responsible for suspending at the final suspend point of this coroutine and transferring execution to the awaiting coroutine. This is the relevant part of the Promise reproduced for your convenience:
To begin with, returning false ...