--p1Od3smaOkJqivj4
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Ara.T.Howard (Ara.T.Howard / noaa.gov) wrote:

> can anyone think of a more elegant way to do this:
>=20
>   ~ > cat drb_fork.rb
>   require 'drb/drb'
>=20
>   def drb_fork obj
>     pipe =3D IO.pipe
>     fork do
>       pipe[0].close
>       pipe =3D pipe[1]
>       DRb.start_service nil, obj
>       pipe.write DRb.uri
        ^^^^^^^^^^^^^^^^^^
I take it this is the important line you're looking for?

>       pipe.close
>       DRb.thread.join
>     end
>     pipe[1].close
>     pipe =3D pipe[0]
>     uri =3D pipe.read
>     DRb.start_service nil, nil rescue nil
>     DRbObject.new nil, uri
>   end
>=20
>   a =3D drb_fork []
>   a << 42
>   p a.first

Use Rinda::RingServer:

http://segment7.net/projects/ruby/drb/rinda/ringserver.html

The description above is the most verbose way to perform service
discovery, since you get a DRb server running as a name service.
Instead you can just plug your front object into the RingServer, if you
only ever need one front.

--=20
Eric Hodel - drbrain / segment7.net - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E  7C11 332A 551C 796C 9F04


--p1Od3smaOkJqivj4
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (FreeBSD)

iD8DBQFA9Y8FMypVHHlsnwQRAiQnAKDFgRrN84OnfQL5TOooC6XE6fFNRQCeOQXG
gC7Am/z8B0cShkR7FDNl/So=
=NfiZ
-----END PGP SIGNATURE-----

--p1Od3smaOkJqivj4--

Ara.T.Howard (Ara.T.Howard / noaa.gov) wrote:

> can anyone think of a more elegant way to do this:
>=20
>   ~ > cat drb_fork.rb
>   require 'drb/drb'
>=20
>   def drb_fork obj
>     pipe =3D IO.pipe
>     fork do
>       pipe[0].close
>       pipe =3D pipe[1]
>       DRb.start_service nil, obj
>       pipe.write DRb.uri
        ^^^^^^^^^^^^^^^^^^
I take it this is the important line you're looking for?

>       pipe.close
>       DRb.thread.join
>     end
>     pipe[1].close
>     pipe =3D pipe[0]
>     uri =3D pipe.read
>     DRb.start_service nil, nil rescue nil
>     DRbObject.new nil, uri
>   end
>=20
>   a =3D drb_fork []
>   a << 42
>   p a.first

Use Rinda::RingServer:

http://segment7.net/projects/ruby/drb/rinda/ringserver.html

The description above is the most verbose way to perform service
discovery, since you get a DRb server running as a name service.
Instead you can just plug your front object into the RingServer, if you
only ever need one front.

--=20
Eric Hodel - drbrain / segment7.net - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E  7C11 332A 551C 796C 9F04

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (FreeBSD)

iD8DBQFA9Y8FMypVHHlsnwQRAiQnAKDFgRrN84OnfQL5TOooC6XE6fFNRQCeOQXG
gC7Am/z8B0cShkR7FDNl/So=
=NfiZ
-----END PGP SIGNATURE-----