Skip to Main Content
C++ Reactive Programming
book

C++ Reactive Programming

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

std::atomic<bool>

std::atomic<bool> is a full-featured atomic Boolean type compared to std::atomic_flag. But neither copy-construction nor assignment is possible with this type. The value of an std::atomic<bool> object can initially be either true or false. The objects of this type can be constructed or assigned values from a non-atomic bool:

std::atomic<bool> flg(true);flg = false;

One thing needs to be noted about the assignment operator of atomic types, which is that the operator returns the value of non-atomic types rather than the conventional scheme of returning references. If a reference is returned instead of a value, it would create a situation where the result of assignment gets the result of a modification by another thread, that ...

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

Boost.Asio C++ Network Programming Cookbook

Boost.Asio C++ Network Programming Cookbook

Dmytro Radchuk

Publisher Resources

ISBN: 9781788629775Supplemental Content