Just something I ran into and thought may be of use to others.
Read this article: Windows with C++ - Lightweight Cooperative Multitasking with C++ | Microsoft Learn
It describes a method of using some macros to setup a switch statement that allows you to yield and resume a 'Task'.
Its the most lightweight implementation I have ever seen.
Hope it helps.