Re: XForms: Forking a child (again)

Steve Lamont (spl@szechuan.ucsd.edu)
Fri, 29 May 98 09:19:47 PDT

# To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> Now Steve mentioned something about the 'horrible async error', but what's that
> exactly?
> Whenever my program forks, at every X-event I get an error like:
> Xlib: Reply sequence number (0x2e9)
> exceeds request sequence number(0x2e8)
> in reply type 0x1!
>
> And I mean every! (motion/press/release/enter/leave)

It sounds as if you have more than one process trying to interact with
XForms or X. This is a no-no.

> Steve also said to
> "Yes, if you confine the interaction between the program and XForms to
> only one process -- multiple processes trying to talk to the server
> over the same descriptor will cause the dreaded "Xlib async error"."
>
> How to confine this?

I think that it's pretty clear. Once you fork() only issue XForms
function calls from one process. It really doesn't matter whether
it's the parent or a random child but one *and only one* process in
the process group may talk to the server over that connection.

I haven't experimented with this in a lot of detail in a while but I
think if you close the X connection descriptor (use the Xlib macro
ConnectionNumber to determine the descriptor) with the close() system
call immediately after the fork() you're probably in good shape. I
suspect that if the child exits before the parent does and this isn't
done, you'll probably confuse the X server.

spl
_________________________________________________
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/