{"id":2182,"date":"2017-11-05T17:14:58","date_gmt":"2017-11-05T22:14:58","guid":{"rendered":"https:\/\/bitpost.com\/news\/?p=2182"},"modified":"2017-11-05T17:26:40","modified_gmt":"2017-11-05T22:26:40","slug":"c11-interactive-thread","status":"publish","type":"post","link":"https:\/\/bitpost.com\/news\/2017\/c11-interactive-thread\/","title":{"rendered":"C++11 interactive thread"},"content":{"rendered":"<p>This is a sweet spot of thread functionality for me at the moment, mixing boost and c++11, so I&#8217;m throwing it down here.\u00a0 It&#8217;s also in my Reusable code on git.<\/p>\n<pre>\/\/ --------------------------------------------------------------------\r\n\/\/ CONCISE EXAMPLE OF THREAD WITH EXTERNALLY-ACCESSIBLE STATUS AND DATA\r\n\/\/ --------------------------------------------------------------------\r\n\/\/ We create a vector, and create a thread to start stuffing it.\r\n\/\/ Externally, we can check the status of the job, and have mutex access to the data.\r\n\/\/ The atomic job stage is SO CHEAP to change and check, do it all day long as needed.\r\n\/\/ Initially, externally, we check the job stage.\r\n\/\/ Meanwhile, we do a bunch of intense work inside the mutex.\r\n\/\/ Then we do smaller work with frequent mutexing, allowing interruption.\r\n\/\/ Great patterns, use them brother!\r\n\/\/ Hells to the yeah.\r\n\/\/ --------------------------------------------------------------------\r\nstd::atomic&lt;int32_t&gt; job_stage(0);\r\nstd::unordered_set&lt;int&gt; data;\r\nboost::shared_mutex data_guard;\r\ndata.insert(-1);\r\nstd::thread t([&amp;job_stage,&amp;data,&amp;data_guard] {\r\n    \/\/ stage 1 = jam in data\r\n    job_stage = 1;\r\n    {\r\n        boost::upgrade_lock&lt;boost::shared_mutex&gt; lock(data_guard);\r\n        boost::upgrade_to_unique_lock&lt;boost::shared_mutex&gt; uniqueLock(lock);\r\n        for (int loop = 0; loop &lt; 2000; ++loop)\r\n        {\r\n            std::this_thread::sleep_for(1ms);\r\n            data.insert(loop);\r\n        }\r\n    }\r\n    \/\/ stage 2 = mutex-jam data, allowing intervention\r\n    job_stage = 2;\r\n    for (int loop = 3000000; loop &lt; 4000000 &amp;&amp; job_stage == 2; ++loop)\r\n    {\r\n        boost::upgrade_lock&lt;boost::shared_mutex&gt; lock(data_guard);\r\n        boost::upgrade_to_unique_lock&lt;boost::shared_mutex&gt; uniqueLock(lock);\r\n        data.insert(loop);\r\n    }\r\n    cout &lt;&lt; \"thread exiting...\" &lt;&lt; endl;\r\n});\r\n\r\ncout &lt;&lt; \"pre mutex job stage: \" &lt;&lt; job_stage &lt;&lt; endl;\r\n\r\nfor (int check = 0; check &lt; 5; ++check)\r\n{\r\n    std::this_thread::sleep_for(200ms);\r\n    \/\/ not sure why i was getting std::hex output...\r\n    cout &lt;&lt; \"check \" &lt;&lt; check &lt;&lt; \" job stage: \";\r\n    {\r\n        boost::upgrade_lock&lt;boost::shared_mutex&gt; lock(data_guard);\r\n        cout  &lt;&lt; dec &lt;&lt; job_stage &lt;&lt; \" data size \" &lt;&lt; data.size();\r\n    }\r\n    cout &lt;&lt; endl;\r\n}\r\n\r\n\/\/ We can trigger the thread to exit.\r\njob_stage = 3;\r\n\r\n\/\/ Let's see what happens if we don't join until after the thread is done.\r\nstd::this_thread::sleep_for(300ms);\r\ncout &lt;&lt; \"done sleeping\" &lt;&lt; endl;\r\n\r\n\/\/ NOW we will block to ensure the thread finishes.\r\ncout &lt;&lt; \"joining\" &lt;&lt; endl;\r\nt.join();\r\ncout &lt;&lt; \"all done\" &lt;&lt; endl;\r\n\/\/ --------------------------------------------------------------------<\/pre>\n<p>Output:<\/p>\n<p><code>pre mutex job stage: 1<br \/>\ncheck 0 job stage: 2 data size 2031<br \/>\ncheck 1 job stage: 2 data size 225848<br \/>\ncheck 2 job stage: 2 data size 456199<br \/>\ncheck 3 job stage: 2 data size 726576<br \/>\ncheck 4 job stage: 2 data size 936429<br \/>\nthread exiting...<br \/>\ncheck 5 job stage: 2 data size 1002001<br \/>\ndone sleeping<br \/>\njoining<br \/>\nall done<\/code><\/p>\n<pre><code><\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This is a sweet spot of thread functionality for me at the moment, mixing boost and c++11, so I&#8217;m throwing it down here.\u00a0 It&#8217;s also in my Reusable code on git. \/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; \/\/ CONCISE EXAMPLE OF THREAD WITH EXTERNALLY-ACCESSIBLE STATUS AND DATA \/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; \/\/ We create a vector, and create a thread to [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[22,19],"tags":[],"class_list":["post-2182","post","type-post","status-publish","format-standard","hentry","category-cpp","category-opensource"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.9 - aioseo.com -->\n\t<meta name=\"description\" content=\"This is a sweet spot of thread functionality for me at the moment, mixing boost and c++11, so I&#039;m throwing it down here. It&#039;s also in my Reusable code on git. \/\/ -------------------------------------------------------------------- \/\/ CONCISE EXAMPLE OF THREAD WITH EXTERNALLY-ACCESSIBLE STATUS AND DATA \/\/ -------------------------------------------------------------------- \/\/ We create a vector, and create a thread to\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"m\"\/>\n\t<meta name=\"keywords\" content=\"c++,open source\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/bitpost.com\/news\/2017\/c11-interactive-thread\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.9\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"bitpost.com\/news | Note to self\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"C++11 interactive thread | bitpost.com\/news\" \/>\n\t\t<meta property=\"og:description\" content=\"This is a sweet spot of thread functionality for me at the moment, mixing boost and c++11, so I&#039;m throwing it down here. It&#039;s also in my Reusable code on git. \/\/ -------------------------------------------------------------------- \/\/ CONCISE EXAMPLE OF THREAD WITH EXTERNALLY-ACCESSIBLE STATUS AND DATA \/\/ -------------------------------------------------------------------- \/\/ We create a vector, and create a thread to\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/bitpost.com\/news\/2017\/c11-interactive-thread\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2017-11-05T22:14:58+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2017-11-05T22:26:40+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"C++11 interactive thread | bitpost.com\/news\" \/>\n\t\t<meta name=\"twitter:description\" content=\"This is a sweet spot of thread functionality for me at the moment, mixing boost and c++11, so I&#039;m throwing it down here. It&#039;s also in my Reusable code on git. \/\/ -------------------------------------------------------------------- \/\/ CONCISE EXAMPLE OF THREAD WITH EXTERNALLY-ACCESSIBLE STATUS AND DATA \/\/ -------------------------------------------------------------------- \/\/ We create a vector, and create a thread to\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/2017\\\/c11-interactive-thread\\\/#article\",\"name\":\"C++11 interactive thread | bitpost.com\\\/news\",\"headline\":\"C++11 interactive thread\",\"author\":{\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/author\\\/m\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/#person\"},\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/2017\\\/c11-interactive-thread\\\/#articleImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/884c1dbbf1027f261dbf20652687af7ad0030bfa71ff0ef56540938bdc70be2f?s=96&d=monsterid&r=pg\",\"width\":96,\"height\":96,\"caption\":\"m\"},\"datePublished\":\"2017-11-05T17:14:58-05:00\",\"dateModified\":\"2017-11-05T17:26:40-05:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/2017\\\/c11-interactive-thread\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/2017\\\/c11-interactive-thread\\\/#webpage\"},\"articleSection\":\"C++, Open Source\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/2017\\\/c11-interactive-thread\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/bitpost.com\\\/news\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/category\\\/projects\\\/#listItem\",\"name\":\"Projects\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/category\\\/projects\\\/#listItem\",\"position\":2,\"name\":\"Projects\",\"item\":\"https:\\\/\\\/bitpost.com\\\/news\\\/category\\\/projects\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/category\\\/projects\\\/opensource\\\/#listItem\",\"name\":\"Open Source\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/category\\\/projects\\\/opensource\\\/#listItem\",\"position\":3,\"name\":\"Open Source\",\"item\":\"https:\\\/\\\/bitpost.com\\\/news\\\/category\\\/projects\\\/opensource\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/2017\\\/c11-interactive-thread\\\/#listItem\",\"name\":\"C++11 interactive thread\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/category\\\/projects\\\/#listItem\",\"name\":\"Projects\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/2017\\\/c11-interactive-thread\\\/#listItem\",\"position\":4,\"name\":\"C++11 interactive thread\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/category\\\/projects\\\/opensource\\\/#listItem\",\"name\":\"Open Source\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/#person\",\"name\":\"m\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/2017\\\/c11-interactive-thread\\\/#personImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/884c1dbbf1027f261dbf20652687af7ad0030bfa71ff0ef56540938bdc70be2f?s=96&d=monsterid&r=pg\",\"width\":96,\"height\":96,\"caption\":\"m\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/author\\\/m\\\/#author\",\"url\":\"https:\\\/\\\/bitpost.com\\\/news\\\/author\\\/m\\\/\",\"name\":\"m\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/2017\\\/c11-interactive-thread\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/884c1dbbf1027f261dbf20652687af7ad0030bfa71ff0ef56540938bdc70be2f?s=96&d=monsterid&r=pg\",\"width\":96,\"height\":96,\"caption\":\"m\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/2017\\\/c11-interactive-thread\\\/#webpage\",\"url\":\"https:\\\/\\\/bitpost.com\\\/news\\\/2017\\\/c11-interactive-thread\\\/\",\"name\":\"C++11 interactive thread | bitpost.com\\\/news\",\"description\":\"This is a sweet spot of thread functionality for me at the moment, mixing boost and c++11, so I'm throwing it down here. It's also in my Reusable code on git. \\\/\\\/ -------------------------------------------------------------------- \\\/\\\/ CONCISE EXAMPLE OF THREAD WITH EXTERNALLY-ACCESSIBLE STATUS AND DATA \\\/\\\/ -------------------------------------------------------------------- \\\/\\\/ We create a vector, and create a thread to\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/2017\\\/c11-interactive-thread\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/author\\\/m\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/author\\\/m\\\/#author\"},\"datePublished\":\"2017-11-05T17:14:58-05:00\",\"dateModified\":\"2017-11-05T17:26:40-05:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/#website\",\"url\":\"https:\\\/\\\/bitpost.com\\\/news\\\/\",\"name\":\"bitpost.com\\\/news\",\"description\":\"Note to self\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/bitpost.com\\\/news\\\/#person\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"C++11 interactive thread | bitpost.com\/news","description":"This is a sweet spot of thread functionality for me at the moment, mixing boost and c++11, so I'm throwing it down here. It's also in my Reusable code on git. \/\/ -------------------------------------------------------------------- \/\/ CONCISE EXAMPLE OF THREAD WITH EXTERNALLY-ACCESSIBLE STATUS AND DATA \/\/ -------------------------------------------------------------------- \/\/ We create a vector, and create a thread to","canonical_url":"https:\/\/bitpost.com\/news\/2017\/c11-interactive-thread\/","robots":"max-image-preview:large","keywords":"c++,open source","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/bitpost.com\/news\/2017\/c11-interactive-thread\/#article","name":"C++11 interactive thread | bitpost.com\/news","headline":"C++11 interactive thread","author":{"@id":"https:\/\/bitpost.com\/news\/author\/m\/#author"},"publisher":{"@id":"https:\/\/bitpost.com\/news\/#person"},"image":{"@type":"ImageObject","@id":"https:\/\/bitpost.com\/news\/2017\/c11-interactive-thread\/#articleImage","url":"https:\/\/secure.gravatar.com\/avatar\/884c1dbbf1027f261dbf20652687af7ad0030bfa71ff0ef56540938bdc70be2f?s=96&d=monsterid&r=pg","width":96,"height":96,"caption":"m"},"datePublished":"2017-11-05T17:14:58-05:00","dateModified":"2017-11-05T17:26:40-05:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/bitpost.com\/news\/2017\/c11-interactive-thread\/#webpage"},"isPartOf":{"@id":"https:\/\/bitpost.com\/news\/2017\/c11-interactive-thread\/#webpage"},"articleSection":"C++, Open Source"},{"@type":"BreadcrumbList","@id":"https:\/\/bitpost.com\/news\/2017\/c11-interactive-thread\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/bitpost.com\/news#listItem","position":1,"name":"Home","item":"https:\/\/bitpost.com\/news","nextItem":{"@type":"ListItem","@id":"https:\/\/bitpost.com\/news\/category\/projects\/#listItem","name":"Projects"}},{"@type":"ListItem","@id":"https:\/\/bitpost.com\/news\/category\/projects\/#listItem","position":2,"name":"Projects","item":"https:\/\/bitpost.com\/news\/category\/projects\/","nextItem":{"@type":"ListItem","@id":"https:\/\/bitpost.com\/news\/category\/projects\/opensource\/#listItem","name":"Open Source"},"previousItem":{"@type":"ListItem","@id":"https:\/\/bitpost.com\/news#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/bitpost.com\/news\/category\/projects\/opensource\/#listItem","position":3,"name":"Open Source","item":"https:\/\/bitpost.com\/news\/category\/projects\/opensource\/","nextItem":{"@type":"ListItem","@id":"https:\/\/bitpost.com\/news\/2017\/c11-interactive-thread\/#listItem","name":"C++11 interactive thread"},"previousItem":{"@type":"ListItem","@id":"https:\/\/bitpost.com\/news\/category\/projects\/#listItem","name":"Projects"}},{"@type":"ListItem","@id":"https:\/\/bitpost.com\/news\/2017\/c11-interactive-thread\/#listItem","position":4,"name":"C++11 interactive thread","previousItem":{"@type":"ListItem","@id":"https:\/\/bitpost.com\/news\/category\/projects\/opensource\/#listItem","name":"Open Source"}}]},{"@type":"Person","@id":"https:\/\/bitpost.com\/news\/#person","name":"m","image":{"@type":"ImageObject","@id":"https:\/\/bitpost.com\/news\/2017\/c11-interactive-thread\/#personImage","url":"https:\/\/secure.gravatar.com\/avatar\/884c1dbbf1027f261dbf20652687af7ad0030bfa71ff0ef56540938bdc70be2f?s=96&d=monsterid&r=pg","width":96,"height":96,"caption":"m"}},{"@type":"Person","@id":"https:\/\/bitpost.com\/news\/author\/m\/#author","url":"https:\/\/bitpost.com\/news\/author\/m\/","name":"m","image":{"@type":"ImageObject","@id":"https:\/\/bitpost.com\/news\/2017\/c11-interactive-thread\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/884c1dbbf1027f261dbf20652687af7ad0030bfa71ff0ef56540938bdc70be2f?s=96&d=monsterid&r=pg","width":96,"height":96,"caption":"m"}},{"@type":"WebPage","@id":"https:\/\/bitpost.com\/news\/2017\/c11-interactive-thread\/#webpage","url":"https:\/\/bitpost.com\/news\/2017\/c11-interactive-thread\/","name":"C++11 interactive thread | bitpost.com\/news","description":"This is a sweet spot of thread functionality for me at the moment, mixing boost and c++11, so I'm throwing it down here. It's also in my Reusable code on git. \/\/ -------------------------------------------------------------------- \/\/ CONCISE EXAMPLE OF THREAD WITH EXTERNALLY-ACCESSIBLE STATUS AND DATA \/\/ -------------------------------------------------------------------- \/\/ We create a vector, and create a thread to","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/bitpost.com\/news\/#website"},"breadcrumb":{"@id":"https:\/\/bitpost.com\/news\/2017\/c11-interactive-thread\/#breadcrumblist"},"author":{"@id":"https:\/\/bitpost.com\/news\/author\/m\/#author"},"creator":{"@id":"https:\/\/bitpost.com\/news\/author\/m\/#author"},"datePublished":"2017-11-05T17:14:58-05:00","dateModified":"2017-11-05T17:26:40-05:00"},{"@type":"WebSite","@id":"https:\/\/bitpost.com\/news\/#website","url":"https:\/\/bitpost.com\/news\/","name":"bitpost.com\/news","description":"Note to self","inLanguage":"en-US","publisher":{"@id":"https:\/\/bitpost.com\/news\/#person"}}]},"og:locale":"en_US","og:site_name":"bitpost.com\/news | Note to self","og:type":"article","og:title":"C++11 interactive thread | bitpost.com\/news","og:description":"This is a sweet spot of thread functionality for me at the moment, mixing boost and c++11, so I'm throwing it down here. It's also in my Reusable code on git. \/\/ -------------------------------------------------------------------- \/\/ CONCISE EXAMPLE OF THREAD WITH EXTERNALLY-ACCESSIBLE STATUS AND DATA \/\/ -------------------------------------------------------------------- \/\/ We create a vector, and create a thread to","og:url":"https:\/\/bitpost.com\/news\/2017\/c11-interactive-thread\/","article:published_time":"2017-11-05T22:14:58+00:00","article:modified_time":"2017-11-05T22:26:40+00:00","twitter:card":"summary","twitter:title":"C++11 interactive thread | bitpost.com\/news","twitter:description":"This is a sweet spot of thread functionality for me at the moment, mixing boost and c++11, so I'm throwing it down here. It's also in my Reusable code on git. \/\/ -------------------------------------------------------------------- \/\/ CONCISE EXAMPLE OF THREAD WITH EXTERNALLY-ACCESSIBLE STATUS AND DATA \/\/ -------------------------------------------------------------------- \/\/ We create a vector, and create a thread to"},"aioseo_meta_data":{"post_id":"2182","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[],"defaultGraph":"","defaultPostTypeGraph":""},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2021-03-13 19:46:02","updated":"2025-08-17 19:17:48","seo_analyzer_scan_date":null},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9M11L-zc","jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts\/2182","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/comments?post=2182"}],"version-history":[{"count":4,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts\/2182\/revisions"}],"predecessor-version":[{"id":2186,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts\/2182\/revisions\/2186"}],"wp:attachment":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/media?parent=2182"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/categories?post=2182"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/tags?post=2182"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}