O'Reilly logo

Mastering C++ Programming by Jeganathan Swaminathan

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

What did you learn?

Let me summarize the takeaway points that you learned in this section:

  • Multiple threads can work together by signaling each other using a conditional variable
  • A conditional variable requires the waiting thread to acquire a mutex before it can wait for a conditional signal
  • Every conditional variable requires unique_lock that accepts a mutex
  • The unique_lock<std::mutex> method works exactly as lock_guard<std::mutex> with some additional useful functionalities, such as deferred locking, manual lock/unlock, ownership transfer, and so on
  • Unique_lock helps avoid deadlocks just like lock_guard, as the mutex wrapped by unique_lock gets unlocked automatically when the unique_lock instance goes out of scope
  • You learned how to write ...

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