From: matz@... (Yukihiro Matsumoto) Date: 2000-09-20T00:51:49+09:00 Subject: [ruby-list:24987] Re: How to check all Thread fin ? まつもと ゆきひろです In message "[ruby-list:24982] Re: How to check all Thread fin ?" on 00/09/19, YANAGAWA Kazuhisa writes: | |全ての終了を待つだけで良いのなら,require "thwait" ですぅ. | |# と,自分が書いたわけでもない undocumented なライブラリを何度も宣伝す |# るやつ :-P e2mmapの使い方が良く分からないのでつい敬遠しちゃうんですよね え。ごめん、石塚さん。 | require "thwait" | | for i in 0..3 | Thread.new(i) do | |n| | puts "thread #{n} starts." | sleep(rand(10)) | puts "thread #{n} ends." | end | end | | tl = Thread.list-[Thread.current] | p [tl, Thread.current] | | tw = ThreadsWait.new(tl) | tw.all_waits | |....って,deadlock っていいますねぇ.... 私何か間違ってます? えーと tw = ThreadsWait.new(tl) を tw = ThreadsWait.new(*tl) とすると動きます。型チェックのないことの弊害ですね。 どうするのが良いかなあ。 まつもと ゆきひろ /:|)