21. Multithreading: the producer-consumer problem

Watch the video of the learning process: [Crazy God Speaks Java]
https://www.bilibili.com/video/BV1V4411p7EF?p=3
Welcome everyone to support Oh, very conscientious teacher!

1. Thread communication

Insert picture description here

2. Thread communication analysis

Insert picture description here

3. Java provides several methods to solve communication problems between threads

Insert picture description here

4. Solution

Solution 1

Insert picture description here

Solution 2

Insert picture description here

Guess you like

Origin blog.csdn.net/qq_41347385/article/details/109806751