From: nobu.nokada@... Date: 2004-11-25T08:26:21+09:00 Subject: Re: ThreadWait problem Hi, At Thu, 25 Nov 2004 04:09:24 +0900, Vance A Heron wrote in [ruby-talk:121320]: > For large trees, the code never exited, and looking I found > tgroup to contain several threads with a status of nil. > > I first added the line > abort_on_execption = true > thinking that some of the threads were dying unexpectedly, > and being ignored. Stil no joy. Yes, Thread#status returns nil the thread died by an exception. Does the following patch help you? > In desperation i've added the following. > near the begining of the file after including thwait > ---- > class ThreadsWait > attr_accessor :threads > end > ---- > > Immediately prior to the 2nd while > --- > tgroup.threads.delete_if {|t| t.status == nil } > --- Can you inspect @wait_queue of tgroup and Thread.list at that time? I.E., !tgroup.threads.empty? and !tgroup.threads.all? Index: lib/thwait.rb =================================================================== RCS file: /cvs/ruby/src/ruby/lib/thwait.rb,v retrieving revision 1.8 diff -U2 -p -d -r1.8 thwait.rb --- lib/thwait.rb 18 Apr 2004 23:19:46 -0000 1.8 +++ lib/thwait.rb 24 Nov 2004 23:23:48 -0000 @@ -118,6 +118,9 @@ class ThreadsWait for th in threads Thread.start(th) do |t| - t.join - @wait_queue.push t + begin + t.join + ensure + @wait_queue.push t + end end end -- Nobu Nakada