Cpp-standard-library-cpp-atomic-flag

提供:Dev Guides
移動先:案内検索

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
....................