BOOK / SOURCE & READING RECORD
C++ Concurrency in Action
Anthony Williams
1st edition, 2012, ISBN 9781933988771; additionally inspected 2nd-edition public previews (2019)
C++ Concurrency in Action
Fully read chapters 1–10 and appendices A–D of the 2012 first edition (main-text pages 1–486); additionally read the visible portions of chapters 1 and 2 from the unauthenticated second-edition preview, without claiming to have finished the second edition. The first-edition public PDF's web conversion breaks at page 194, so a private local text was used to continue reading through the end of appendix D; table of contents and index are not counted as main text. Historical APIs and examples are not the C++20 specification; this article does not copy lock-free container implementations.
Edition, actual reading range, and original sources →Sources
- Manning first-edition publisher page
2012 first edition; the full-book reading source is a public copy in the private evidence record, not a publisher-authorized free full text.
- Manning second-edition public preview of chapter 2
Visible second-edition preview of 2.1–2.5 and the summary; some paragraphs are truncated; does not count as complete coverage of the second edition.
Synchronization proofs are more reliable than timing guesses
First edition chapter 2, 2.1–2.3; chapter 4, 4.1; chapter 5, 5.2–5.3; chapter 7, 7.2; chapter 10, 10.2
Whether a thread has finished, whether state is readable, and whether an object is still alive are three different questions. The first edition writes from thread ownership through shared state, condition variables, and memory order, offering the common perspective of looking for an explainable happens-before relationship rather than trusting that the machine is slow enough or that one has waited long enough. Notification itself does not store business facts; the predicate protected by the mutex stores the facts. Likewise, each update of an atomic counter is indivisible, but that does not automatically make a multi-field protocol hold. Reading the lock-free chapters also requires separately proving node reclamation and pointer updates; a successful compare-exchange cannot substitute for object-lifetime analysis. For today's engineering I preferentially keep easy-to-review locks and explicit lifetimes; only when measurement proves a bottleneck exists do I discuss splitting locks or lowering memory order. C++20's jthread shortens the boilerplate for reclaiming threads, but it does not design the shutdown protocol for us.
Related fundamentals
Thread lifetime: thread, jthread, and stop_tokenCondition variables: predicates, lost wakeups, and spurious wakeupsMemory order: relaxed, acquire-release, and happens-before