Skip to Main Content
C++ Concurrency in Action, Second Edition
book

C++ Concurrency in Action, Second Edition

by Anthony Williams
February 2019
Intermediate to advanced content levelIntermediate to advanced
592 pages
20h 37m
English
Manning Publications
Content preview from C++ Concurrency in Action, Second Edition

Chapter 3. Sharing data between threads

This chapter covers

  • Problems with sharing data between threads
  • Protecting data with mutexes
  • Alternative facilities for protecting shared data

One of the key benefits of using threads for concurrency is the potential to easily and directly share data between them, so now that we’ve covered starting and managing threads, let’s look at the issues surrounding shared data.

Imagine for a moment that you’re sharing an apartment with a friend. There’s only one kitchen and one bathroom. Unless you’re particularly friendly, you can’t both use the bathroom at the same time, and if your roommate occupies the bathroom for a long time, it can be frustrating if you need to use it. Likewise, though it might be possible ...

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.
Start your free trial

You might also like

C++ Concurrency in Action

C++ Concurrency in Action

Anthony Williams
Programming Rust, 2nd Edition

Programming Rust, 2nd Edition

Jim Blandy, Jason Orendorff, Leonora F. S. Tindall

Publisher Resources

ISBN: 9781617294693Supplemental ContentPublisher SupportOtherPublisher WebsiteSupplemental ContentPurchase Link