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_timed_mutex. These provide for multiple-reader/single-writer mutex locks.
std::scoped_lockfrom C++17 for locking multiple mutexes together.
- Parallel overloads of many standard library algorithms
Plus, full coverage of the library extensions from the concurrency TS:
std::experimental::latchto allow waiting for a set number of events to occur
std::experimental::flex_barrierto synchronize groups of threads
std::experimental::atomic_shared_ptrto allow atomic accesses to a single
shared_ptrinstance from multiple threads, as a better alternative that the
- Extended futures that allow continuations, so additional functions can be scheduled for when a future is ready.
std::experimental::when_anyto 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 now in print.
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.