Sha256: e1f0de9ab7d57284032e25c05f8fbe61119d32c77ddfcb11f8974fd7e7aa6051
Contents?: true
Size: 1003 Bytes
Versions: 5
Compression:
Stored size: 1003 Bytes
Contents
class Fwd::Worker class << self private :new def fork(opts) GC.copy_on_write_friendly = true if GC.respond_to?(:copy_on_write_friendly=) child_read, parent_write = IO.pipe parent_read, child_write = IO.pipe pid = Process.fork do begin parent_write.close parent_read.close output = Fwd::Output.new(opts) process(output, child_read, child_write) ensure child_read.close child_write.close end end child_read.close child_write.close new(pid, parent_read, parent_write) end def process(output, read, write) while !read.eof? path = Marshal.load(read) begin result = call_with_index(items, index, options, &block) result = nil if options[:preserve_results] == false rescue Exception => e result = ExceptionWrapper.new(e) end Marshal.dump(result, write) end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
fwd-0.4.0 | lib/fwd/worker.rb |
fwd-0.3.3 | lib/fwd/worker.rb |
fwd-0.3.2 | lib/fwd/worker.rb |
fwd-0.3.1 | lib/fwd/worker.rb |
fwd-0.3.0 | lib/fwd/worker.rb |