Chapter 9. Parallelism and Concurrency
In this chapter, we will cover the following recipes:
- Automatically parallelizing code that uses standard algorithms
- Putting a program to sleep for specific amounts of time
- Starting and stopping threads
- Performing exception-safe shared locking with
std::unique_lockandstd::shared_lock - Avoiding deadlocks with
std::scoped_lock - Synchronizing concurrent
std::coutuse - Safely postponing initialization with
std::call_once - Pushing the execution of tasks into the background using
std::async - Implementing the producer/consumer idiom with
std::condition_variable - Implementing the multiple producers/consumers idiom with
std::condition_variable - Parallelizing the ASCII Mandelbrot renderer using
std::async - Implementing a tiny automatic parallelization library with
std::future