Skip to Content
C++ Reactive Programming
book

C++ Reactive Programming

by Praseed Pai, Peter Abraham
June 2018
Intermediate to advanced
348 pages
8h 45m
English
Packt Publishing
Content preview from C++ Reactive Programming

std::atomic_flag

std::atomic_flag represents a Boolean flag, and it is the simplest among all the atomic types in the standard library. This is the only type where all operations on it are required to be lock-free in every platform. This type is very basic, hence it is intended as a building block only.

A std::atomic_flag object must always be initialized with ATOMIC_FLAG_INIT to set the state to clear:

std::atomic_flag flg = ATOMIC_FLAG_INIT;

This is the only atomic type that requires such initialization, irrespective of the scope of its declaration. Once it is initialized, there are only three operations permissible with this type: destroy it, clear it, or set a query for the previous value. These correspond to the destructor, the clear() ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Functional Programming in C++

Functional Programming in C++

Ivan Cukic

Publisher Resources

ISBN: 9781788629775Supplemental Content