Re: XForms: Forking a child (again)

Marco Haverkate (marco@xirion.nl)
Thu, 04 Jun 1998 9:35:38 METDST

# To subscribers of the xforms list from Marco Haverkate <marco@xirion.nl> :

>
> # To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :
>
> > Telling anything to X after the fork will cause problems, because
> > at one point (after the fork) both processes will share the
> > X connection file descriptor, which is VERY BAD.
> > When you call fl_finish() in the child, that's what happens!
>
> Again, you can close the connection in the child explicitly by getting
> the connection number and issuing a close(). This will, of course,
> terminate any interaction with the server. If you do a fork()
> followed by an exec*() the connection will automatically be closed
> since the X server connection is marked close on exec.
>

Yeah! It works. Almost perfect. I just this get the following message:
XIO: fatal IO error 9 (Bad file number) on X server "cobalt.xirion.nl:0.0"
after 1424 requests (1420 known processed) with 0 events remaining.

Can I just ignore it? It looks as if I close the connection with a wrong
number, but I did jst the following:

Display *dpy;
dpy = fl_initialize();
wholelotofwork();
pid=fork();'
if (pid = 1)
{
/* Child */
close(ConnectionNumber(dpy));
somethingelsetobedone;
}

Looks allright to me?
Ciao,

--
Marco B. J. Haverkate, Xirion B.V. De Meern	
e-mail:marco@xirion.nl tel: 030-6661990
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil   or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/