Skip to content

Instantly share code, notes, and snippets.

@ohac
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ohac/9829894 to your computer and use it in GitHub Desktop.
Save ohac/9829894 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby1.8
require "drb"
require 'thwait'
require "rinda/tuplespace"
GC.stress = true
u = "druby://127.0.0.1:12345"
Thread.new do
DRb.start_service(u, Rinda::TupleSpace.new)
end
ts = DRbObject.new_with_uri(u)
threads = 2.times.map do
Thread.new do
ts.write([1])
ts.take([Integer])
end
end
ThreadsWait.all_waits(*threads)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment