Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!ucbvax!bloom-beacon!LARRY.MCRCIM.MCGILL.EDU!mouse From: mouse@LARRY.MCRCIM.MCGILL.EDU Newsgroups: comp.windows.x Subject: Re: Resources & Forking Message-ID: <9012030508.AA19022@Larry.McRCIM.McGill.EDU> Date: 3 Dec 90 05:08:06 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 49 > 1) Is it possible to use X to read an X resource files without being > connected to a server? Yes, provided you really mean "file". > If it is possible, how would I do it?? The R4 way would be to use... To retrieve a database from disk, use XrmGetFileDatabase. XrmDatabase XrmGetFileDatabase(filename) char *filename; filename Specifies the resource database file name. I don't know whether R3 is capable of similar things, though I would assume it is. > 2) If I open a display, then fork I presume both processes are > sharing a connection to the server. (I assume you're using UNIX.) Yes. > 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? As you may have gathered from the above and from other postings, server access is not necessary for reading resource files. Leaving the connection open in both parent and child will not harm anything, *provided* that only one of the two processes ever tries to do anything with it after the fork. (Two processes both trying to use the same server connection will almost certainly get Xlib in a hopelessly confused state. You don't want to do it[%].) [%] Unless, of course, you're willing to take on the task of putting the necessary synchronization code into Xlib. This would be a major effort. Actually, you don't even want to XCloseDisplay() in the process that won't be using the connection; this could flush buffered data twice. Either ignore the X connection entirely or close its file descriptor without letting Xlib know: close(XConnectionNumber(dpy)). der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu