{"id":2703,"date":"2013-11-08T07:00:00","date_gmt":"2013-11-08T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2013\/11\/08\/whats-the-point-of-the-various-whencallbackreturns-functions\/"},"modified":"2013-11-08T07:00:00","modified_gmt":"2013-11-08T07:00:00","slug":"whats-the-point-of-the-various-whencallbackreturns-functions","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20131108-00\/?p=2703","title":{"rendered":"What&#039;s the point of the various &#8230;WhenCallbackReturns functions?"},"content":{"rendered":"<p>The thread pool provides a number of functions named <code>...When&shy;Callback&shy;Returns<\/code>. What&#8217;s the point of all these functions? Why can&#8217;t you just do the operation yourself immediately before returning?\n <a href=\"http:\/\/blogs.msdn.com\/b\/oldnewthing\/archive\/2013\/11\/07\/10464408.aspx\"> We saw <code>Free&shy;Library&shy;When&shy;Callback&shy;Returns<\/code> last time<\/a>. What&#8217;s the point of the others?<\/p>\n<p> Basically, the same thing as <code>Free&shy;Library&shy;When&shy;Callback&shy;Returns<\/code>. It&#8217;s a way to release a resource after execution has left the function and the callback is marked as complete. In the case of a synchronization resource, that resource may be what&#8217;s keeping somebody from unloading your DLL, or it might protect a race condition between the callback function and a function that tries to cancel the callback. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>The thread pool provides a number of functions named &#8230;When&shy;Callback&shy;Returns. What&#8217;s the point of all these functions? Why can&#8217;t you just do the operation yourself immediately before returning? We saw Free&shy;Library&shy;When&shy;Callback&shy;Returns last time. What&#8217;s the point of the others? Basically, the same thing as Free&shy;Library&shy;When&shy;Callback&shy;Returns. It&#8217;s a way to release a resource after execution has [&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-2703","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>The thread pool provides a number of functions named &#8230;When&shy;Callback&shy;Returns. What&#8217;s the point of all these functions? Why can&#8217;t you just do the operation yourself immediately before returning? We saw Free&shy;Library&shy;When&shy;Callback&shy;Returns last time. What&#8217;s the point of the others? Basically, the same thing as Free&shy;Library&shy;When&shy;Callback&shy;Returns. It&#8217;s a way to release a resource after execution has [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/2703","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=2703"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/2703\/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=2703"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=2703"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=2703"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}