Thread

来源:互联网 发布:环球易购 知乎 编辑:程序博客网 时间:2024/05/01 03:41

 

 

In Producer.run(), the for-loop will never increment i to 1. As whenever the productBox add the product 8 times leaving index to be 8, it waits until the consumer consumes all the 8 product, leaving the index to be 0 again, and the producer wakes up to see that index is again 0 and do it again. It will forever loop and never stop.