class Parallel::Worker
Attributes
pid[R]
read[R]
thread[RW]
write[R]
Public Class Methods
new(read, write, pid)
click to toggle source
# File lib/parallel.rb, line 36 def initialize(read, write, pid) @read, @write, @pid = read, write, pid end
Public Instance Methods
close_pipes()
click to toggle source
# File lib/parallel.rb, line 40 def close_pipes read.close write.close end
wait()
click to toggle source
# File lib/parallel.rb, line 45 def wait Process.wait(pid) rescue Interrupt # process died end
work(data)
click to toggle source
# File lib/parallel.rb, line 51 def work(data) begin Marshal.dump(data, write) rescue Errno::EPIPE raise DeadWorker end begin Marshal.load(read) rescue EOFError raise DeadWorker end end