[ba.windows.x] Resources & Forking

gah@arnor.uucp (11/29/90)

Two questions...

1)  Is it possible to use X to read an X resource files without 
    being connected to a server?  If it is possible, how would 
    I do it??  I am currently using r3 & Motif 1.0.  If it makes
    a difference, can r4 or r5 do such stuff .. but not r3??

2)  If I open a display, then fork I presume both processes are
    sharing a connection to the server.  If one process only 
    wishes to read X resource files is there any problem with
    not explicitly synchronizing the processes?  Or does any 
    database operation require server contact?

thx, g

argv@turnpike.Eng.Sun.COM (Dan Heller) (11/29/90)

In article <1990Nov28.191838.4990@arnor.uucp> gah@ibm.com (Gary Hoffman) writes:
> 1)  Is it possible to use X to read an X resource files without 
>     being connected to a server?
No.  You must be connected to the server in order for the Xlib routines
to access the database associated with it (you can have a resource file
unique to every server).

> 2)  If I open a display, then fork I presume both processes are
>     sharing a connection to the server.
Nope.  Just the parent.  The child's connection *must* be closed.
You can reopen a -new- connection to the server and rebuild widgets
or do whatever you want.  I submitted a program called "vines" to
comp.sources.x several months ago which demonstrates this.  Basically,
it just sits there and forks allowing each child to draw colored vines
all over your screen.  If you are using Motif to do things, your child
process will have to build those widgets specific to that process.
Thus, it is best to fork early in a program since forking causes the
entire dataspece to be copied.  Since running X programs can be large,
your forked process should try to do whatever it can quickly and get
out soon.

> If one process only 
>     wishes to read X resource files is there any problem with
>     not explicitly synchronizing the processes?  Or does any 
>     database operation require server contact?

None of this will work.
--
dan
----------------------------------------------------
O'Reilly && Associates   argv@sun.com / argv@ora.com
Opinions expressed reflect those of the author only.