Skip to content
TopicTracker
From HackerNewsView original
TranslationTranslation

Cancellation of Windows Runtime activities is asynchronous

Cancellation of Windows Runtime activities is inherently asynchronous, meaning that after requesting cancellation, the operation may not terminate immediately. This requires developers to properly handle the asynchronous nature of cancellation in their code.

Background

- The Windows Runtime (WinRT) is a programming model introduced in Windows 8 that allows apps written in different languages (C++, C#, JavaScript) to call system features via a common API. Cancellation here refers to stopping an in-progress async operation (like reading a file or fetching network data). - Unlike traditional synchronous cancellation (where cancel() immediately stops work), WinRT cancellation is asynchronous: calling cancel() signals the operation to stop, but the operation itself must check this signal cooperatively and then notify the caller that it has completed (or faulted). This means the caller must await or handle a completion callback even after issuing a cancel. - The author, Raymond Chen, is a veteran Microsoft developer known for his long-running blog "The Old New Thing," which explains Windows internals and API design decisions in deep, often quirky detail. His audience is experienced Windows developers.

Related stories