Re: XForms: Forking a child (again)

Tristan Savatier (tristan@bok.net)
Tue, 02 Jun 1998 16:02:36 -0700

# To subscribers of the xforms list from Tristan Savatier <tristan@bok.net> :

Marco Haverkate wrote:
>
> >
> > You should fork/execvp BEFORE opening any X connection
> > (including initializing Xforms).
> >
>
> But that's not what I wan, really. I want to fork when the user, interacting
> with the program, chooses a specific menu-option. I've tried an fl-finish()
> in the child after the fork, but this does not work.

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!

You should fork BEFORE initializing Xforms,
and then the forked process should
enter a loop (reading some commands on a pipe).

You can define the actions that the forked process
should do for your commands, such as forking
yet another process with some parameters, if you want.
You can also open X from the child process. It will
use another connection and there will be no problem there.

We do that with mtv/mtvp and it works very well.

Regards, -- Tristan Savatier (President, MpegTV LLC)

MpegTV: /cgi-bin/exit-to?http://www.mpegtv.com
_________________________________________________
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/