Re: g_coprocess()




Sascha Ziemann <szi@aibon.ping.de> writes:

> Owen Taylor <otaylor@gtk.org> writes:
> 
> | The main thing to watch out for is to use _exit() instead
> | of exit() in the child, so the child doesn't try to clean
> | up the parent's X connection.
> 
> But this requires the child to know about the parent. I can not
> guaranty this, when I want to start any child program. Isn't there a
> way to detach all the X stuff from the child?

If you are fork()'ing than exec()'ing, then there is no problem,
since exec() doesn't do all the cleanup that exit() does
 
>   if (fork () == 0)
>     {
>       close (in_fd[1]);
>       close (out_fd[0]);
>       
>       dup2 (in_fd[0], STDIN_FILENO);
>       dup2 (out_fd[1], STDOUT_FILENO);
> 
>       gtk_exit_child ();

Not necessary here. (And a bit hard to implement, because even if you
take care of all of GTK/GDK atexit() functions in some fashion, you
still have to worry about what Xlib does.)
 
>       execlp ("child", NULL);
>     }

Regards,
                                        Owen



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]