Overview of the 2nd edition
The second edition is being updated to cover C++14, C++17 and the Concurrency TS, along with general improvements throughout the book.
This includes full coverage of the library changes from C++14 and C++17:
std::shared_mutex
andstd::shared_timed_mutex
. These provide for multiple-reader/single-writer mutex locks.std::scoped_lock
from C++17 for locking multiple mutexes together.- Parallel overloads of many standard library algorithms
include
std::sort
,std::for_each
andstd::transform_reduce
.
Plus, full coverage of the library extensions from the concurrency TS:
std::experimental::latch
to allow waiting for a set number of events to occurstd::experimental::barrier
andstd::experimental::flex_barrier
to synchronize groups of threadsstd::experimental::atomic_shared_ptr
to allow atomic accesses to a singleshared_ptr
instance from multiple threads, as a better alternative that thestd::atomic_load
andstd::atomic_store
free functions.- Extended futures that allow continuations, so additional functions can be scheduled for when a future is ready.
std::experimental::when_all
andstd::experimental::when_any
to allow waiting for either all of a set of futures to be ready, or the first of a set of futures to be ready.
The second edition is currently only available through the Manning Early Access Program. Sign up now to get PDF copies of each chapter as it becomes available, with updates as they are made, and a print copy of the full book when it is complete.
The second edition does of course continue to cover everything from the first edition.
Overview of the first edition
Systems with multiple processors or processors with multiple cores are the norm these days; even many phones have multicore processors. To take advantage of these processor cores you need to use concurrency, either in the form of multiple processors or multiple threads.
With the advent of the C++11 standard, C++ now offers standardized support for multithreaded applications in the form of new library classes and functions and a new multithreading-aware memory model.
C++ Concurrency in Action is about writing programs in C++ using multiple threads for concurrency and the C++ language features and library facilities that make that possible. This book provides a tutorial covering the use of the new C++11 library facilities, such as std::thread, std::future and std::condition_variable, as well as an in-depth description of the new memory model and std::atomic classes for low level synchronization. In later chapters, the book then goes on to cover the design of multithreaded code, including lock-free data structures and thread pools. Finally, there is a chapter on testing and debugging multithreaded applications.
It doesn't stop there though: the appendices include a brief overview of the new language features in C++11 such as variadic templates, lambda functions and rvalue references, as well as a 127 page reference covering every class and function in the C++11 Standard Thread Library.