Re: [問題] blocking queue 實作

作者: sean72 (.)   2018-07-21 18:20:58
※ 引述《sean72 (.)》之銘言:
: 標題: Re: [問題] blocking queue 實作
: 時間: Sat Jul 21 17:25:43 2018
:
: 謝謝幫忙review
:
:
: : 推 flarehunter: 在空的時候同時有2個get()和1個put()可能會壞掉 07/20 23:30
: : → flarehunter: 有兩個MyQueue物件也會壞掉 另外為什麼要繼承Thread? 07/20 23:31
:
: https://paste.ubuntu.com/p/Zjh3y6ychm/
: 抄了source code,改成這樣
:
: Consumer1先跑,取得了self.not_empty,並且因為que == 0
: 所以等在while loop裡 (wait())
:
: Consumer2接著跑,此時C2能取得self.not_empty lock嗎?
: 他是怎麼進入等待的?
:
:
:
作者: flarehunter (Range)   2018-07-21 18:48:00
官方文件沒有保證notify會照wait的順序

Links booklink

Contact Us: admin [ a t ] ucptt.com