[comp.windows.x] X and RPC libraries: Can they co-exist?

wright@hsi86.hsi.com (Gary Wright) (01/22/91)

Has anyone tried to integrate RPC mechanisms within the X toolkit
event loop programming model?  I am looking specifically for anyone who
has experience with Sun's ONC system or Apollo/HP/OSF's NCS RPC mechanisms
with any X toolkit.  It doesn't seem to me to be a straight forward problem
since both types of libraries (X & RPC) make certain assumptions about blocking
on sockets reads and neither was designed with the other in mind.

Thanks in advance for any pointers.
-- 
Gary Wright                                                 ...!uunet!hsi!wright
3M Health Information Systems					  wright@hsi.com

fkittred@bbn.com (Fletcher Kittredge) (01/24/91)

In article <2962@hsi86.hsi.com> wright@hsi86.hsi.com (Gary Wright) writes:
>
>Has anyone tried to integrate RPC mechanisms within the X toolkit
>event loop programming model?  I am looking specifically for anyone who
>has experience with Sun's ONC system or Apollo/HP/OSF's NCS RPC mechanisms
>with any X toolkit.  It doesn't seem to me to be a straight forward problem
>since both types of libraries (X & RPC) make certain assumptions about blocking
>on sockets reads and neither was designed with the other in mind.
>

OSF DCE comes with a threads package, which addresses this problem.  If
you don't have access to a system with DCE, then you could get help from 
a POSIX 1003.4a threads package, or a Mach C threads package.  I don't know
if Sun's ONC has a threads package associated with it. Sun's current thread
implementation will be of no help since it is a user space implementation
which blocks all threads if the current thread is waiting on a syscall.

regards,
fletcher

Fletcher Kittredge
Platforms and Tools Group, BBN Software Products
10 Fawcett Street,  Cambridge, MA. 02138
617-873-3465  /  fkittred@bbn.com  /  fkittred@das.harvard.edu

db@helium.East.Sun.COM (David Brownell) (01/25/91)

In article <62280@bbn.BBN.COM> fkittred@spca.bbn.com (Fletcher Kittredge) writes:
> In article <2962@hsi86.hsi.com> wright@hsi86.hsi.com (Gary Wright) writes:

> >Has anyone tried to integrate RPC mechanisms within the X toolkit
> >event loop programming model?  I am looking specifically for anyone who
> >has experience with Sun's ONC system or Apollo/HP/OSF's NCS RPC mechanisms
> >with any X toolkit.  It doesn't seem to me to be a straight forward problem
> >since both types of libraries (X & RPC) make certain assumptions about blocking
> >on sockets reads and neither was designed with the other in mind.

> OSF DCE comes with a threads package, which addresses this problem.
> 				... Sun's current thread
> implementation will be of no help since it is a user space implementation
> which blocks all threads if the current thread is waiting on a syscall.

Don't draw the conclusion that you can't use SunRPC with X toolkits
because Sun's current (4.x) LWP library isn't kernel-based; that would be
wrong.  SunRPC was designed with the knowledge that it would need to be
integrated with other event loops; I know of several tools that talk to
each other using SunRPC.

Using only public interfaces -- look for documentation on custom versions
of svc_run(), which is the primary server side component to block -- it's
easy to have X applications act as SunRPC servers, so that incoming RPC
requests are dispatched just like incoming X protocol messages are.  Blocking
as an RPC client can usually be minimized or even avoided; otherwise, it's
just another case where an X application needs to disable input temporarily.

The current XView sources already have that server side support, if you
request it by calling notify_enable_rpc_svc(TRUE).  It's not tough to do
the same with raw Xlib or intrinsics, either, but does require grokking
both toolkit and SunRPC documentation.  There's no need to wait for a new
networking or OS framework unless you really want to.

- Dave

One of the Million monkeys ... see, here's my keyboard!