O'Reilly logo

C++ Concurrency in Action: Practical Multithreading by Anthony Williams

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 2. Managing threads

This chapter covers
  • Starting threads, and various ways of specifying code to run on a new thread
  • Waiting for a thread to finish versus leaving it to run
  • Uniquely identifying threads

OK, so you’ve decided to use concurrency for your application. In particular, you’ve decided to use multiple threads. What now? How do you launch these threads, how do you check that they’ve finished, and how do you keep tabs on them? The C++ Standard Library makes most thread-management tasks relatively easy, with just about everything managed through the std::thread object associated with a given thread, as you’ll see. For those tasks that aren’t so straightforward, the library provides the flexibility to build ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required