I have have several forked processes simultateously accessing the data 
area with the following function, and it all goes horribly wrong.

   def extract(dest,name,mode)
     User.asroot {
       start=0
       fn = path(dest,name)
       File.open(fn,File::CREAT|File::WRONLY,mode) { |file|
         DATA.rewind
         DATA.each { |line|
           if start==0
             start=1 if line =~ %r{^=begin #{name} -*}
           else
             break if line =~ %r{^=end -*}
             yield line if block_given?
             file.puts line
           end
         }
       }
     }
   end

Each process gets partial or corrupt data. Now it obviously has 
something to do with the DATA object being shared between processes 
somehow (there is presumably a file handle in there somewhere), but how 
can I fix it?

Andrew Walrond