{"id":41853,"date":"2003-11-13T03:28:00","date_gmt":"2003-11-13T03:28:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2003\/11\/13\/answer-to-previous-exercise-about-m_frecursing\/"},"modified":"2003-11-13T03:28:00","modified_gmt":"2003-11-13T03:28:00","slug":"answer-to-previous-exercise-about-m_frecursing","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20031113-00\/?p=41853","title":{"rendered":"Answer to previous exercise about m_fRecursing"},"content":{"rendered":"<p> Answer to <a href=\"http:\/\/blogs.gotdotnet.com\/raymondc\/PermaLink.aspx\/d680eeef-00e5-4c2b-b8fe-ec8f6c88c2d8\"> previous exercise<\/a>: The <code>m_fRecursing<\/code> flag does not need to be per-instance. It only needs to be valid long enough that the recursive call that comes immediately afterwards can be detected. However, a global variable would not work because two threads might be inside the recursive <code>DefDlgProc<\/code> call simultaneously. But a thread-local variable would work. (If you prefer to code in plain C or don&#8217;t want to use classes, you may find this alternative easier to work with.)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Answer to previous exercise: The m_fRecursing flag does not need to be per-instance. It only needs to be valid long enough that the recursive call that comes immediately afterwards can be detected. However, a global variable would not work because two threads might be inside the recursive DefDlgProc call simultaneously. But a thread-local variable would [&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-41853","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>Answer to previous exercise: The m_fRecursing flag does not need to be per-instance. It only needs to be valid long enough that the recursive call that comes immediately afterwards can be detected. However, a global variable would not work because two threads might be inside the recursive DefDlgProc call simultaneously. But a thread-local variable would [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/41853","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=41853"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/41853\/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=41853"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=41853"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=41853"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}