From: Eleanor McHugh Date: 2009-06-24T05:31:40+09:00 Subject: Re: Threads + Forks in Ruby 1.9.1p129 On 23 Jun 2009, at 20:17, Roger Pack wrote: >> On 1.8.6 with green threads a fork() could result in a child process >> with all the threads present in the parent process, however I know >> that with the Apple default install of 1.8.6 on Leopard this is not >> the case. As I don't have the time to dig into the sources right now >> I'll float the hypothesis that 1.8.6 is being built with pthreads. > > running this code: > > Thread.new { puts 'hello'; loop { sleep 1; puts 'in 1' + > Process.pid.to_s} } > fork { > puts 'child' + Process.pid.to_s > sleep > } > puts 'parent' + Process.pid.to_s > sleep > > on ruby 1.8.7 [linux, no pthreads] results in only the parent running > the thread, and also 1.9.2 does the same. For what it's worth it > seems > that threads really don't run in child processes. Thank goodness for that. Whilst I much prefer the idea of a forked process being a genuine duplicate of its parent (which I think is more in line with the original conception of fork) consistency has much to commend it. Ellie Eleanor McHugh Games With Brains http://slides.games-with-brains.net ---- raise ArgumentError unless @reality.responds_to? :reason