{"id":99355,"date":"2018-07-27T07:00:00","date_gmt":"2018-07-27T21:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/?p=99355"},"modified":"2019-03-13T00:40:58","modified_gmt":"2019-03-13T07:40:58","slug":"20180727-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20180727-00\/?p=99355","title":{"rendered":"Is the <CODE>Terminate&shy;Thread<\/CODE> function synchronous?"},"content":{"rendered":"<p>A customer wanted to know whether the <code>Terminate&shy;Thread<\/code> function was synchronous. In other words, does the <code>Terminate&shy;Thread<\/code> function wait until the target thread has definitely terminated before returning? <\/p>\n<p>No. The <code>Terminate&shy;Thread<\/code> function queues a termination to the target thread but does not wait for confirmation that the termination has occurred. <\/p>\n<p>If you want to wait until the target thread has definitely terminated, wait for the thread object to become singnaled, say by calling <code>Wait&shy;For&shy;Single&shy;Object<\/code>. <\/p>\n<p>But please, <a HREF=\"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/20150814-00\/?p=91811\">stop calling <code>Terminate&shy;Thread<\/code><\/a>. There are no valid use cases for it. Any time you call it, you will corrupt the target process, so you may as well just terminate the entire process and be done with it. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Nope. It merely starts the termination but does not wait for the termination to complete.<\/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-99355","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>Nope. It merely starts the termination but does not wait for the termination to complete.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/99355","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=99355"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/99355\/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=99355"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=99355"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=99355"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}