Skip to content

Instantly share code, notes, and snippets.

@dakrone
Created August 25, 2009 22:02
Show Gist options
  • Select an option

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

Select an option

Save dakrone/175066 to your computer and use it in GitHub Desktop.
# Stripped down Child
pid = fork
unless pid
DRb.start_service
# fetch the TupleSpace over DRb using a proxy object
ts = Rinda::TupleSpaceProxy.new(DRbObject.new_with_uri('druby://127.0.0.1:53421'))
loop do
# break if no more items in the queue
break if done_work and ts.read_all([:enum, nil, nil]).empty?
item = ts.take([:enum, nil, nil])
result = block.call(item[2])
# return result, item[1] is the result's index in an array or hash
ts.write([:result, item[1], result])
end
DRb.stop_service
exit!
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment