From: Brad Hilton Date: 2001-03-03T22:39:56+09:00 Subject: [ruby-talk:11934] Re: problem with threads and fastcgi Jonathan Feinberg wrote: > Brad Hilton 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