From: nobu.nakada@... Date: 2000-09-24T09:54:27+09:00 Subject: [ruby-list:25133] Re: How to check all Thread fin ? Hi, At Sun, 24 Sep 2000 05:51:14 +0900, Aleksi Niemela wrote: > > deadlock 0x810104c: 2:0 (main) - /usr/local/lib/ruby/1.6/thread.rb:178 > > /usr/local/lib/ruby/1.6/thwait.rb:103:in `pop': Thread: > > deadlock (fatal) > > Yashi pointed me to this thread as it seems we have some interesting > behaviour here. I'm not sure if this is the patch actually fixes the bug, > but at least I didn't manage to get any error messages afterwards. I read your patch and found it's a thread shared local variable problem. Index: thwait.rb =================================================================== RCS file: /home/cvs/ruby/lib/thwait.rb,v retrieving revision 1.4 diff -u -2 -p -r1.4 thwait.rb --- thwait.rb 2000/09/21 06:37:23 1.4 +++ thwait.rb 2000/09/24 00:43:03 @@ -97,9 +97,9 @@ class ThreadsWait # adds thread(s) to join, no wait. def join_nowait(*threads) - @threads.concat threads.flatten + threads.flatten! + @threads.concat threads for th in threads - Thread.start do - th = th.join - @wait_queue.push th + Thread.start(th) do |t| + @wait_queue.push t.join end end