From: Eric Hodel Date: 2006-04-25T03:41:58+09:00 Subject: Re: a flaw in tuplespace implementation? On Apr 23, 2006, at 9:37 PM, xa3a.mc@gmail.com wrote: > have you tried combining the tuplespace and ring API? It makes no difference if you use Rinda::Ring or not. > your example indeed works when ring API is not used, simply > providing a tuplespace as a DRb service instead of a Ring service. > but i'd rather have some code that would enable me to automatically > find a tuplespace, not manually by passing the tuplespace's uri. So just throw in Rinda::Ring. > i modified your code to show you the problem i faced in my first > post, and added two ring files (name server and space provider, > which is actually your code as listed in your segment7 site) Since you didn't respond to the same thread I've since lost that email. I suggest you subscribe to the mailing list rather than post through the forum. $ cat rs.rb require 'rinda/ring' require 'rinda/tuplespace' DRb.start_service Rinda::RingServer.new Rinda::TupleSpace.new DRb.thread.join $ cat ts.rb require 'drb' require 'rinda/tuplespace' require 'rinda/ring' require 'x' DRb.start_service ts = Rinda::TupleSpace.new provider = Rinda::RingProvider.new :TupleSpace, ts, 'Tuple Space' provider.provide DRb.thread.join $ cat master.rb require 'drb' require 'rinda/ring' require 'x' DRb.start_service rs = Rinda::RingFinger.primary tuple = rs.read [:name, :TupleSpace, nil, nil] ts = tuple[2] x = X.new x.value = 0 ts.write [:x, x] $ cat slave.rb require 'drb' require 'rinda/ring' require 'x' DRb.start_service rs = Rinda::RingFinger.primary tuple = rs.read [:name, :TupleSpace, nil, nil] ts = tuple[2] obj = ts.read [:x, nil] p obj.last p obj.last.value obj.last.value = 100 p obj.last.value $ cat x.rb class X attr_accessor :value end $ ruby rs.rb & [1] 28527 $ ruby ts.rb & [2] 28528 $ ruby master.rb $ ruby slave.rb # 0 100 -- Eric Hodel - drbrain@segment7.net - http://blog.segment7.net This implementation is HODEL-HASH-9600 compliant http://trackmap.robotcoop.com