{"id":14,"date":"2026-07-27T10:35:26","date_gmt":"2026-07-27T10:35:26","guid":{"rendered":"https:\/\/blog.levadny.com\/?p=14"},"modified":"2026-07-27T10:35:26","modified_gmt":"2026-07-27T10:35:26","slug":"%f0%9d%97%a7%f0%9d%97%b5%f0%9d%97%b2-%f0%9d%97%bc%f0%9d%97%bb%f0%9d%97%b2-%f0%9d%97%b1%f0%9d%97%b6%f0%9d%97%b3%f0%9d%97%b3%f0%9d%97%b2%f0%9d%97%bf%f0%9d%97%b2%f0%9d%97%bb%f0%9d%97%b0%f0%9d%97%b2","status":"publish","type":"post","link":"https:\/\/blog.levadny.com\/?p=14","title":{"rendered":"\ud835\udde7\ud835\uddf5\ud835\uddf2 \ud835\uddfc\ud835\uddfb\ud835\uddf2 \ud835\uddf1\ud835\uddf6\ud835\uddf3\ud835\uddf3\ud835\uddf2\ud835\uddff\ud835\uddf2\ud835\uddfb\ud835\uddf0\ud835\uddf2 \ud835\uddef\ud835\uddf2\ud835\ude01\ud835\ude04\ud835\uddf2\ud835\uddf2\ud835\uddfb \ud835\ude00\ud835\ude01\ud835\uddf1::\ud835\ude01\ud835\uddf5\ud835\uddff\ud835\uddf2\ud835\uddee\ud835\uddf1 \ud835\uddee\ud835\uddfb\ud835\uddf1 \ud835\ude00\ud835\ude01\ud835\uddf1::\ud835\uddf7\ud835\ude01\ud835\uddf5\ud835\uddff\ud835\uddf2\ud835\uddee\ud835\uddf1"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s consider a simple function called longTimeFunction. It simply prints a message indicating it has started, waits for three seconds, and then prints a message indicating it has finished.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If we run this function using std::jthread &#8211; leveraging the wrapper class&#8217;s dtor for convenience &#8211; the program will terminate successfully; this is because std::jthread automatically calls join() in its dtor when the thread object is destroyed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If we use std::thread, however, the program will terminate with an error, as join() is not called automatically in the dtor, requiring us to call it manually.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This is a key difference between the two when terminating a thread by destroying the object. Of course, there are other differences as well.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"750\" src=\"https:\/\/blog.levadny.com\/wp-content\/uploads\/2026\/07\/post1.jpg\" alt=\"\" class=\"wp-image-15\" srcset=\"https:\/\/blog.levadny.com\/wp-content\/uploads\/2026\/07\/post1.jpg 800w, https:\/\/blog.levadny.com\/wp-content\/uploads\/2026\/07\/post1-300x281.jpg 300w, https:\/\/blog.levadny.com\/wp-content\/uploads\/2026\/07\/post1-768x720.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Let&#8217;s consider a simple function called longTimeFunction. It simply prints a message indicating it has started, waits for three seconds, and then prints a message indicating it has finished. If we run this function using std::jthread &#8211; leveraging the wrapper class&#8217;s dtor for convenience &#8211; the program will terminate successfully; this is because std::jthread automatically [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-14","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.levadny.com\/index.php?rest_route=\/wp\/v2\/posts\/14","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.levadny.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.levadny.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.levadny.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.levadny.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=14"}],"version-history":[{"count":1,"href":"https:\/\/blog.levadny.com\/index.php?rest_route=\/wp\/v2\/posts\/14\/revisions"}],"predecessor-version":[{"id":16,"href":"https:\/\/blog.levadny.com\/index.php?rest_route=\/wp\/v2\/posts\/14\/revisions\/16"}],"wp:attachment":[{"href":"https:\/\/blog.levadny.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=14"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.levadny.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=14"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.levadny.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=14"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}