tags:

views:

157

answers:

1

In our project which supports multiplatform (Linux, Solaris, Windows) and coded in c,c++ , we are using ONC Rpc for IPC. Recently there is a requirement to have an application server to work on two different programs no.

I have tried following to test.

Created a multithread application Within that creted two worker threads

    In first thread I’m
         a) Creating a tcp transport  
         b) Registering the transport 
         c) Calling svc_run

    In second thread I’
         a) Creating second tcp transport
         b) Registering the transport with a different program no
         c) Calling svc_run*

I have tried this on RHEL 4 and its workind fine for me. But is it valid to register two programs no and call svc_run in two different threads?

I have tried searching over net but was not able to find any clear information on this.

+1  A: 

It seems logical that this is possible, although I never tried it myself.

Please not the -M command switch of rpcgen IDL compiler (this is from its man page on Solaris):

 -M          Generates multithread-safe stubs for passing
             arguments   and   results   between  rpcgen-
             generated code and user written  code.  This
             option  is useful  for users who want to use
             threads in their code.

If the proxy/stub code is thread-safe, and you register two event loops with 2 different RPC process numbers--my guess is this should behave as if you actually had 2 different processes (RPC-wise).

Nikola Gedelovski