From: kjana@... (YANAGAWA Kazuhisa) Date: 2000-09-19T21:39:47+09:00 Subject: [ruby-list:24982] Re: How to check all Thread fin ? In message <87k8c9m2az.wl@studly.netlab.co.jp> shugo@ruby-lang.org writes: > すべてのスレッドの終了を待つだけでよいのならjoinが使えると思いま > す。 全ての終了を待つだけで良いのなら,require "thwait" ですぅ. # と,自分が書いたわけでもない undocumented なライブラリを何度も宣伝す # るやつ :-P 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 っていいますねぇ.... 私何か間違ってます? # tl に待つ thread が入らない用に Thread.current はひいてるし,ちゃん # と入ってない事はわかってるんですけど.... # ruby 1.6.0 (2000-08-24) [i386-freebsdelf3.1] Queue#pop で no_wait の時,queue が空なら Thread.current が stop しま すけど,この時の ensure 節に入ってる Thread.critical = false はちゃん と実行されるんですよね? 何が悪いのか追っかけ切れない. -- 柳川和久 @ 東大阪市 . 大阪府 September 19, 2000 「善なる意識が宇宙パワーで愛の波動に輪廻転生するんだろ?」 「メチャクチャインチキ話じゃないですか」