2011-06-27から1日間の記事一覧
thread.rbでQueue#.popがこのように定義されている。 def pop(non_block=false) @mutex.synchronize{ while true if @que.empty? raise ThreadError, "queue empty" if non_block @waiting.push Thread.current @mutex.sleep else return @que.shift end end…
thread.rbでQueue#.popがこのように定義されている。 def pop(non_block=false) @mutex.synchronize{ while true if @que.empty? raise ThreadError, "queue empty" if non_block @waiting.push Thread.current @mutex.sleep else return @que.shift end end…