Skip to main content

C++ coroutines: The initial and final suspend, and improving our return_value method

Last time, we had a basic implementation of a promise type but left with the question of what the initial_suspend and final_suspend are for.
When the compiler encounters a coroutine function, it performs multiple rewrite passes. One of the early passes produces the following:
return_type MyCoroutine(args...)
{
create coroutine state
copy parameters to coroutine frame
promise_type p;

The post C++ coroutines: The initial and final suspend, and improving our return_value method appeared first on The Old New Thing.

2021-03-31 14:00:00Z 0001-01-01 00:00:00Z https://devblogs.microsoft.com/oldnewthing/20210331-00/?p=105028

Comments

Popular posts from this blog