From: Joel VanderWerf Date: 2004-06-21T14:53:31+09:00 Subject: Re: "warning: fork terminates thread" Hal Fulton wrote: > I'm not really troubled by this much, but I want to understand it. > > Apparently there's no way to carry a running thread across a fork. > This is fine -- no one should try that anyway IMO. > > My concerns are: > 1. The phrasing makes it sound as though the thread in the parent > process is terminated when a fork happens. This, fortunately, > is not the case. I guess it means the thread is terminated in the child, as soon as as the child starts up, as you've probably figured out. But it does sound alarming. > 2. Sometimes I get this message when I think there should be no > threads still running. Is it possible that the thread is a > "false positive" or something? Is there such a thing as a > zombie thread? Hm. Try dumping Thread.list.inspect before forking? > 3. And finally, is there a way to disable this specific warning? Looks like your wish will soon come true: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/95802 Btw, there's one situation where this warning is, well, educational. When you fork while another thread holding a lock of some kind (e.g., a Mutex). The lock will remain locked forever in the child, because the only thread that can unlock it is gone. (I once adapted the Mutex class to avoid getting bitten by this.)