{"id":1853,"date":"2014-02-06T07:00:00","date_gmt":"2014-02-06T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2014\/02\/06\/if-an-asynchronous-io-completes-synchronously-is-the-hevent-in-the-overlapped-structure-signaled-anyway\/"},"modified":"2014-02-06T07:00:00","modified_gmt":"2014-02-06T07:00:00","slug":"if-an-asynchronous-io-completes-synchronously-is-the-hevent-in-the-overlapped-structure-signaled-anyway","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20140206-00\/?p=1853","title":{"rendered":"If an asynchronous I\/O completes synchronously, is the hEvent in the OVERLAPPED structure signaled anyway?"},"content":{"rendered":"<p>Yes.\n When an I\/O completes (whether synchronously or asynchronously), the event is signaled and completion status notifications are queued. The <code>Get&shy;Overlapped&shy;Result\/Ex<\/code> function can be used to wait on an I\/O that has already completed; it will merely return immediately. If you ask <code>Has&shy;Overlapped&shy;Io&shy;Completed<\/code> whether the I\/O has completed, and the I\/O completed synchronously, it will correctly report, &#8220;Yeah, of course it completed. Heck, it completed a long time ago!&#8221;<\/p>\n<p> In other words, you can logically treat the case of an asynchronous I\/O request completing synchronously as if it had completed asynchronously. It just completes asynchronously <i>before you even blinked<\/i>. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Yes. When an I\/O completes (whether synchronously or asynchronously), the event is signaled and completion status notifications are queued. The Get&shy;Overlapped&shy;Result\/Ex function can be used to wait on an I\/O that has already completed; it will merely return immediately. If you ask Has&shy;Overlapped&shy;Io&shy;Completed whether the I\/O has completed, and the I\/O completed synchronously, it will [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-1853","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>Yes. When an I\/O completes (whether synchronously or asynchronously), the event is signaled and completion status notifications are queued. The Get&shy;Overlapped&shy;Result\/Ex function can be used to wait on an I\/O that has already completed; it will merely return immediately. If you ask Has&shy;Overlapped&shy;Io&shy;Completed whether the I\/O has completed, and the I\/O completed synchronously, it will [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/1853","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=1853"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/1853\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=1853"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=1853"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=1853"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}