File: rindac.rb

package info (click to toggle)
ruby1.9 1.9.0.2-9lenny1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 36,284 kB
  • ctags: 54,135
  • sloc: ruby: 280,863; ansic: 261,105; yacc: 16,427; sh: 4,148; lisp: 1,732; tcl: 949; pascal: 639; makefile: 468; sed: 155; xml: 64; perl: 62; python: 47; awk: 36; asm: 25
file content (17 lines) | stat: -rw-r--r-- 318 bytes parent folder | download | duplicates (23)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
require 'drb/drb'
require 'rinda/rinda'

uri = ARGV.shift || raise("usage: #{$0} <server_uri>")

DRb.start_service
ts = Rinda::TupleSpaceProxy.new(DRbObject.new(nil, uri))

(1..10).each do |n|
  ts.write(['sum', DRb.uri, n])
end

(1..10).each do |n|
  ans = ts.take(['ans', DRb.uri, n, nil])
  p [ans[2], ans[3]]
end