Re: [gtk-list] Re: Re



On Sat, 25 Sep 1999 16:23:55 -0700, Theodore Roth wrote:
> Havoc Pennington wrote:
>> You can only access GTK from the parent process, and you need to use
>> _exit() rather than exit() to leave the child.
> 
> This has been confusing me for a while. I understand the child's use of
> _exit() after the fork call, and that you shouldn't access GTK from the
> child. But what about exec()ing another GTK program, or the same program
> for that matter, from the child?

That's no problem. If the socket to the X server is marked close-on-exec,
it will automatically be closed at exec(). Otherwise, the exec()-ed
program will have an extra open file descriptor (without knowing it) which
will be closes as soon as it exits. Nothing will go wrong, because the
original GTK cleanup routines will not be called.

> Since you are overlaying the new programs memory on top of the old, and
> starting execution from the beginning, I thought this would be safe. Am
> I wrong or right here?

You are right that it is safe, but for other reasons ;-).


Erik

-- 
J.A.K. (Erik) Mouw, Information and Communication Theory Group, Department
of Electrical Engineering, Faculty of Information Technology and Systems,
Delft University of Technology, PO BOX 5031,  2600 GA Delft, The Netherlands
Phone: +31-15-2785859  Fax: +31-15-2781843  Email J.A.K.Mouw@its.tudelft.nl
WWW: http://www-ict.its.tudelft.nl/~erik/




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