Skip to content

Instantly share code, notes, and snippets.

@dakrone
Created August 25, 2009 21:57
Show Gist options
  • Select an option

  • Save dakrone/175063 to your computer and use it in GitHub Desktop.

Select an option

Save dakrone/175063 to your computer and use it in GitHub Desktop.
# Stripped down version of the parent's job
pts = Rinda::TupleSpace.new
items.each_with_index { |item, index|
pts.write([:enum, index, item])
}
provider = nil
provider = DRb.start_service('druby://127.0.0.1:53421', pts)
pids.reverse.each { |p|
Process.waitpid(p)
}
# Grab results
items.size.times do
result_tuples << pts.take([:result, nil, nil])
end
provider.stop_service
# gather results and sort them
result_tuples.map { |t|
results[t[1]] = t[2]
}
return results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment