e\$B\$\$\$^\$\$\$G\$9!#e(B

SizedQueue e\$B\$K;XDj\$7\$?e(B max e\$B0J>e\$N%*%V%8%’%/%H\$re(B push
e\$B\$7\$h\$&\$H\$9\$k\$He(B
e\$B\$K\$J\$C\$F\$7\$^\$\$\$^\$9!#K\Mh\$O\$=\$3\$G%V%m%C%/\$5\$l\$k\$s\$8\$c\$J\$\$\$+e(B
e\$B\$H;W\$&\$N\$G\$9\$,!"\$I\$s\$J\$b\$s\$G\$7\$g\$&\$+!)e(B

q = SizedQueue.new(1)
2.times{q.push(nil)}

ruby 1.8.4 (2005-12-24) [i486-linux]
/usr/lib/ruby/1.8/thread.rb:426:in `stop': stopping only thread (ThreadError) note: use sleep to stop forever from /usr/lib/ruby/1.8/thread.rb:426:in`push’
from -e:3
from -e:3

e\$B\$K=q\$-D>\$9\$H%V%m%C%/\$7\$F\$/\$l\$k\$h\$&\$K\$J\$j\$^\$9!#B>e(B

e\$B\$J\$+\$@\$G\$9!#e(B

At Fri, 2 Jun 2006 21:05:27 +0900,
Nobuhiro IMAI wrote in [ruby-dev:28678]:

SizedQueue e\$B\$K;XDj\$7\$?e(B max e\$B0J>e\$N%*%V%8%’%/%H\$re(B push e\$B\$7\$h\$&\$H\$9\$k\$He(B
e\$B\$H;W\$&\$N\$G\$9\$,!"\$I\$s\$J\$b\$s\$G\$7\$g\$&\$+!)e(B

q = SizedQueue.new(1)
2.times{q.push(nil)}

e\$BFI\$_=P\$9%9%l%C%I\$,\$\$\$J\$\$\$N\$K%V%m%C%/\$9\$k\$H\$\$\$&\$3\$H\$O!"%G%C%I%m%Ce(B
e\$B%/\$H\$\$\$&\$3\$H\$@\$H;W\$\$\$^\$9\$,!#e(B

e\$B31\$H\$\$\$\$\$^\$9!#e(B

On 2006/06/02, at 21:43, [email protected] wrote:

2.times{q.push(nil)}

e\$BFI\$_=P\$9%9%l%C%I\$,\$\$\$J\$\$\$N\$K%V%m%C%/\$9\$k\$H\$\$\$&\$3\$H\$O!"%G%C%I%m%Ce(B
e\$B%/\$H\$\$\$&\$3\$H\$@\$H;W\$\$\$^\$9\$,!#e(B

e\$B\$3\$s\$JIw\$K;n\$7\$F\$_\$^\$7\$?!#e(B

cinq:~ mas\$ irb --prompt simple -r thread

\$q = SizedQueue.new(1)
=> #<SizedQueue:0x322be8 @waiting=[], @queue_wait=[], @max=1, @que=[]>

th = Thread.new { 2.times { \$q.push(nil) }; ‘done’ }

th

\$q.pop
=> nil

th

th.value
=> “done”

e\$B\$\$\$^\$\$\$G\$9!#e(B

From: nobu_at_ruby-lang.org
Date: Fri, 2 Jun 2006 21:43:17 +0900

2.times{q.push(nil)}

e\$BFI\$_=P\$9%9%l%C%I\$,\$\$\$J\$\$\$N\$K%V%m%C%/\$9\$k\$H\$\$\$&\$3\$H\$O!"%G%C%I%m%Ce(B
e\$B%/\$H\$\$\$&\$3\$H\$@\$H;W\$\$\$^\$9\$,!#e(B

e\$B3N\$+\$K%G%C%I%m%C%/\$G\$9\$M!#FC\$KL54X78\$J%9%l%C%I\$G\$b!"B8:_\$9\$l\$P%V%m%C%/e(B
e\$B\$O\$9\$k\$s\$G\$9\$M!#e(B