https://paste.ubuntu.com/p/cWsFNYcGpQ/
先写了MyQueue1 用一个condition
consumer thread透过condition判断que empty ,就wait, release lock
producer thread透过同一个condition 取得lock, 放东西到que, and notify consumer
但是看了python and java source code
都是用两个condition (not_empty / not_full)
为什么要这么做呢?我的作法应该也行得通,难道是效率问题?
看不透,请大家解疑,感谢