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 ...

Get API Design for C++, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.