Re: fork & gtk-perk = nono




Kenneth Albanowski <kjahds@kjahds.com> writes:

> I'm forwarding this to the list for Marc Lehmann. He's noted that forking
> from within Gtk/Perl does not work very well. I'm not enough of an expert
> in X to know for sure whether this is a fundamental X glitch, a Gtk
> limitation, or just a bug.
> 
> -- 
> Kenneth Albanowski (kjahds@kjahds.com, CIS: 70705,126)
> 
> 
> ---------- Forwarded message ----------
> Date: Sun, 6 Sep 1998 22:48:43 +0200
> From: Marc Lehmann <pcg@goof.com>
> To: kjahds@kjahds.com
> Subject: [gtk-list-request@redhat.com: Re: fork & gtk-perk = nono]
> 
> I tried to "fork" in a perl program while using the perl Gtk module
> (compiled with support for gdkimlib). After the child process exits,
> the parent either dies with broken pipe or segfaults.
> 
> It seems the child process takes the connection to the server down.
> 
> The problem is severe in perl, as a simple "use Gtk" (i.e. without
> initializing the library) already has the effect of rendering
> fork unusable.
> 
> I'm not on the list, please include me in a Cc: when replying thanks.

This is a well known problem with all sorts of X programming.

What you want to do is 

use POSIX qw(_exit);

And when your child quits, quit with _exit not exit.

Regards,
                                        Owen



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