From: "Robert Klemme" <bob.news / gmx.net>
> > >    are there any issues with iterating Thread::list - since this list is
> > >    obviously changing all the time in this code (new Threads started)
> >
> > Maybe,
> >
> >   while th = Thread::list.find {|t| t != Thread.current}
> >     begin
> >       th.join
> >     rescue => e
> >       warn{ e }
> >     end
> >   end
> 
> This does not make a difference as Thread.list() creates a new array on
> each invokation:
> 
> >> Thread.list().id
> => 135026036
> >> Thread.list().id
> => 135022100
> >> Thread.list().id
> => 135018212

The OP mentioned the possibility of new threads being created
all the while.  I had read that as the OP wanting to ensure
that we would handle the joining any new threads that may have
become spawned while we were trying to shut down others.
So my proposed solution was intended to loop until all threads
were truly joined...


Regards,

Bill