9: Concurrency
Abstract
It wasn't until C++11 that the standard defined how code should behave in a multithreaded environment. With that introduction of that revision, it's now possible to write robust multithreaded code in C++ without having to resort to using third-party libraries such as pthreads or Boost. This chapter covers some of the core multithreading features offered by C++. It then explains some of the related terminology, such as concurrency versus parallelism, race conditions, thread safety, and reentrancy. Various techniques are presented to initialize and synchronize data so that your code is safe to use from multiple threads simultaneously. The chapter finishes with a selection of best practices to consider when writing ...
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.
Read now
Unlock full access