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)
為什麼要這麼做呢?我的作法應該也行得通,難道是效率問題?
看不透,請大家解疑,感謝