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