Cancelling a Windows Runtime asynchronous operation, part 3: C++/CX with PPL, coroutine style

This post has been republished via RSS; it originally appeared at: Microsoft Developer Blogs.

Last time, we looked at how task cancellation is projected in C++/CX with PPL and explicit continuations. But how about C++/CX with PPL and coroutines? Notice that coroutines save us a lot of the hassle of setting up the call and timer because the objects live in the coroutine frame, which continues to exist until the coroutine completes. Again, the task throws a task_canceled upon cancellation. This time, it's because of the await_resume for the task awaiter, which you can find in pplawait.h: But wait, the PPL library also supports awaiting on raw IAsyncAction^ and IAsyncOperation^ objects. Next time, we'll look at what happens in that case.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.