Bibliothèque atomique C ++ - Flag

La description

C'est le type atomique booléen sans verrouillage.

Déclaration

Voici la déclaration pour std :: atomic_flag.

class atomic_flag;

Paramètres

aucun

Valeur de retour

aucun

Des exceptions

aucun

Exemple

Dans l'exemple ci-dessous pour 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;
}

L'exemple de sortie devrait être comme ceci -

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