Jonathan Feinberg <jdf / pobox.com> wrote:

> Brad Hilton <bhilton / vpop.net> writes:

> > FCGI.each do |fcgi|
> >   Thread.new(fcgi) { |f|
> [snip]
> >    }
> > end

> You've created a thread, but you do not wait for it to finish what it
> is doing.  In general, the pattern for starting one or mroe threads
> and allowing them to finish is

>   threads = []
>   while some_condition
>      threads << Thread.new {

>      }
>   end
>   threads.each { |t| t.join }

> If you do not join your threads they will be terminated with extreme
> prejudice when the main thread exits.

FCGI.each is the equivalent to a never-ending while loop, so the main
thread never exits until the webserver reloads or stops.  Thanks for the
followup, though.

-Brad