Created
August 25, 2009 21:57
-
-
Save dakrone/175063 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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