MicrosoftDocs / winrt-api

WinRT reference content for developing Microsoft Universal Windows Platform (UWP) apps
Creative Commons Attribution 4.0 International
229 stars 494 forks source link

Clarification on the Stopped state #1447

Open hanabanana opened 4 years ago

hanabanana commented 4 years ago

I read in the paragraph under the image that "The watcher will transition to the Stopped state once all events that are already in the process of being raised have completed.". But in the image, the line from Stopping to Stopped says "All events that were in progress have been raised".

So when device watcher comes to Stopped state, does that mean all events have been raised(event callback might still be running) or all event callbacks have completed?


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

hanabanana commented 4 years ago

Anyone can help with the clarification?

mcleanbyron commented 4 years ago

Thanks for submitting your feedback. I have reached out to the engineering team that owns this API for clarification, and will reply with an update when I have info to share.

smadasam commented 4 years ago

The Stop() method:

All query result actions that are already queued in the caller's process will fire the correct event handlers.

The device watcher is set to allow asynchronous handle closes. This means the WinRT client may asynchronously stop the watcher, and on some other API worker will be pumping results on another thread. If the client calls Close() while on the worker thread, The close event is queued in the result actions, and the worker thread continues to pump results from the queue.

mcleanbyron commented 4 years ago

I'm going to close this issue now that someone from the engineering team has responded. At a glance, it appears that the documentation is in line with the details in the response. If you feel the documentation should be updated, please feel free to reopen this issue with your suggestion, or feel free to click the "Edit" button in the article and submit your own pull request. Thanks for your feedback.