From: Joel VanderWerf Date: 2007-04-05T13:19:38+09:00 Subject: Re: Forking and copying variables Brandon Casci wrote: > I have a script that sets a few variables and then forks. Each fork > executes the script from top to bottom. Is there any way for the forks > to get a copy of all the variables set before the fork, because each > fork thinks it;s running for the first time (and ya I see why because a > fork is a copy of the current process)? > > Maybe forking isn't what I'm looking for, but the performance is so much > better than threading for this task. > > Thanks for reading. > Are you using the win32/process version of fork? If so, what you are seeing is one of the differences between that and native fork on unix/linux. For example, this code: puts "foop" Process.fork do puts "fork" end on linux produces the following output: foop fork and on windows (requiring 'win32/process' first) produces: foop foop fork -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407