Cancelling a Windows Runtime asynchronous operation, part 4: C++/CX with PPL, coroutine style with raw IAsyncAction and IAsyncOperation

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 co_await with tasks. But PPL also supports awaiting directly on IAsyncAction^ and IAsyncOperation^ objects. Let's try it. Observe that awaiting directly on an IAsyncAction^ and IAsyncOperation^ object throws a different exception from awaiting on a task. You can see this in the await_resume for the IAsyncInfo^ awaiter ind in pplawait.h: The PPL framework checks whether the status of the async operation is Canceled, and if so, it throws E_ABORT, which is represented in C++/CX as Operation­Canceled­Exception. So far, all of the cancellation exceptions have generated by the framework. That'll change soon. Next time, we'll look at C++/WinRT.

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.