adding lecture 28
This commit is contained in:
@@ -143,6 +143,7 @@ private:
|
||||
function (student thread, in this example). We pass the necessary shared data from the main thread to the
|
||||
secondary thread to facilitate communication.
|
||||
|
||||
```cpp
|
||||
#define num_notes 10
|
||||
void student_thread(Chalkboard *chalkboard) {
|
||||
Student student(chalkboard);
|
||||
@@ -160,6 +161,8 @@ int main() {
|
||||
}
|
||||
student.join();
|
||||
}
|
||||
```
|
||||
|
||||
- The join command pauses to wait for the secondary thread to finish computation before continuing with the
|
||||
program (or exiting in this example).
|
||||
- What can still go wrong? How can we fix it?
|
||||
|
||||
Reference in New Issue
Block a user