Closed bigdimboom closed 7 years ago
C++/WinRT captures the apartment context before suspending and will resume in the same apartment context. You can also manually switch contexts within a coroutine as illustrated here.
We explained this in detail in our coroutine talk at CppCon last year.
The thread or apartment that a coroutine begins execution on depends on the coroutine type (return type). Most coroutine types don't switch contexts until the first suspension point.
How do I use a coroutine and specify its threading model STA or MTA?