Cpp-standard-library-cpp-atomic-flag

提供:Dev Guides
2020年6月22日 (月) 19:02時点におけるMaintenance script (トーク | 投稿記録)による版 (Imported from text file)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先:案内検索

C ++アトミックライブラリ-フラグ

説明

ロックフリーのブールアトミックタイプです。

宣言

以下は、std
atomic_flagの宣言です。
class atomic_flag;

パラメーター

none

戻り値

none

例外

none

以下のstd
atomic_flagの例。
#include <iostream>
#include <typeinfo>
#include <exception>

class Polymorphic {virtual void member(){}};

int main () {
   try {
      Polymorphic * pb = 0;
      typeid(*pb);
   } catch (std::exception& e) {
      std::cerr << "exception caught: " << e.what() << '\n';
   }
   return 0;
}

サンプル出力は次のようになります-

Output from thread 0
Output from thread 0
Output from thread 0
Output from thread 0
Output from thread 0
Output from thread 0
Output from thread 0
....................