A
Ara.T.Howard
can anyone think of a more elegant way to do this:
~ > cat drb_fork.rb
require 'drb/drb'
def drb_fork obj
pipe = IO.pipe
fork do
pipe[0].close
pipe = pipe[1]
DRb.start_service nil, obj
pipe.write DRb.uri
pipe.close
DRb.thread.join
end
pipe[1].close
pipe = pipe[0]
uri = pipe.read
DRb.start_service nil, nil rescue nil
DRbObject.new nil, uri
end
a = drb_fork []
a << 42
p a.first
~ > ruby drb_fork.rb
42
??
thanks.
-a
--
===============================================================================
| EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE :: 303.497.6469
| A flower falls, even though we love it;
| and a weed grows, even though we do not love it.
| --Dogen
===============================================================================
~ > cat drb_fork.rb
require 'drb/drb'
def drb_fork obj
pipe = IO.pipe
fork do
pipe[0].close
pipe = pipe[1]
DRb.start_service nil, obj
pipe.write DRb.uri
pipe.close
DRb.thread.join
end
pipe[1].close
pipe = pipe[0]
uri = pipe.read
DRb.start_service nil, nil rescue nil
DRbObject.new nil, uri
end
a = drb_fork []
a << 42
p a.first
~ > ruby drb_fork.rb
42
??
thanks.
-a
--
===============================================================================
| EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE :: 303.497.6469
| A flower falls, even though we love it;
| and a weed grows, even though we do not love it.
| --Dogen
===============================================================================