►Full Series Playlist: [ Ссылка ]
►Find full courses on: [ Ссылка ]
►Join as Member to Support the channel: [ Ссылка ]
►Git Repo: [ Ссылка ]
►Lesson Description: In this lesson I teach you about how to use a condition_variable in C++. This is a relatively old concept that is useful for making sure that cpu time is not wasted attempting to constantly 'try' to acquire a lock.
00:00 Synchronization of threads with locks
1:20 Wasted cpu cycles waiting
1:58 Introduction to condition variable
3:20 What is needed for condition variables
4:21 Worker and reporter thread idea
5:00 Implementation of condition variable
5:45 Setting up condition variable
6:30 Setting up our 2 threads
7:20 Setting up worker thread
8:07 Using a unique_lock
9:20 Doing work in reporter thread and updating condition
10:50 notify with condition variable
11:58 Setting up reporting thread
12:46 Condition variable wait
13:20 wait blocks a thread
14:04 notify wakes up a thread
14:34 Syntax fixes
15:08 Logic fixes
15:40 Successful execution of program
16:10 Explanation again of what we have done
►YouTube Channel: [ Ссылка ]
►Please like and subscribe to help the channel!
![](https://i.ytimg.com/vi/XZDx41woDoI/mqdefault.jpg)