<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>yohhoy</author_name>
  <author_url>https://blog.hatena.ne.jp/yohhoy/</author_url>
  <blog_title>yohhoyの日記</blog_title>
  <blog_url>https://yohhoy.hatenadiary.jp/</blog_url>
  <categories>
    <anon>C++</anon>
  </categories>
  <description>プログラミング言語C++のvolatile変数がスレッド間の同期機構として機能するか否かという論点について、有りそうな質問とその答えについての簡易メモ。（自身の思考整理用）結論：このプログラムは可搬性が無く、未定義動作(undefined behavior)を引き起こす。C++11ではvolatile変数でなくatomic変数を用いるべき。C++03以前ではコンパイラ依存の仕組みを利用する。 volatile int running = 1; // 処理スレッド void another_thread() { while (running) { // ??? //... } } // 制御側ス…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fyohhoy.hatenadiary.jp%2Fentry%2F20121016%2Fp1&quot; title=&quot;volatile変数とマルチスレッドとの関係についての押し問答（前編） - yohhoyの日記&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2012-10-16 00:00:00</published>
  <title>volatile変数とマルチスレッドとの関係についての押し問答（前編）</title>
  <type>rich</type>
  <url>https://yohhoy.hatenadiary.jp/entry/20121016/p1</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
