C++ Atomic Library - Flag



Description

It is the lock-free boolean atomic type.

Declaration

Following is the declaration for std::atomic_flag.

 class atomic_flag; 

Parameters

none

Return Value

none

Exceptions

none

Example

In below example for 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; } 

The sample output should be like this −

 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 .................... 
atomic.htm
Advertisements