Skip to Main Content
C++ Concurrency in Action, Second Edition
book

C++ Concurrency in Action, Second Edition

by Anthony Williams
February 2019
Intermediate to advanced content levelIntermediate to advanced
592 pages
20h 37m
English
Manning Publications
Content preview from C++ Concurrency in Action, Second Edition
std::atomic_flag initialization with ATOMIC_FLAG_INIT

An instance of std::atomic_flag may be initialized using the ATOMIC_FLAG_INIT macro, in which case it’s initialized into the clear state. For objects of static storage duration, initialization shall be static initialization.

  • Declaration
    #define ATOMIC_FLAG_INIT unspecified
  • Usage
    std::atomic_flag flag=ATOMIC_FLAG_INIT;
  • Effects Constructs a new std::atomic_flag object in the clear state.
  • Throws Nothing.
std::atomic_flag::test_and_set member function

Atomically sets the flag and checks whether or not it was set.

  • Declaration
    bool test_and_set(memory_order order = memory_order_seq_cst) volatile noexcept; bool test_and_set(memory_order order = memory_order_seq_cst) noexcept; ...
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

C++ Concurrency in Action

C++ Concurrency in Action

Anthony Williams
Programming Rust, 2nd Edition

Programming Rust, 2nd Edition

Jim Blandy, Jason Orendorff, Leonora F. S. Tindall

Publisher Resources

ISBN: 9781617294693Supplemental ContentPublisher SupportOtherPublisher WebsiteSupplemental ContentPurchase Link