Re: [gtk-list] UNIX signal handling



On Fri, Jul 10, 1998 at 07:20:56PM +0200, Daniel Solaz wrote:
> The HTML docs simply state that GTK will install several signal
> handlers. I'm talking about unix signals now.
> What purpose do they serve? Do they clean up things on exit? Is there
> any reason why resetting them would be a bad idea?
> -Daniel
> 

i dug around in this area as well and found that in gdk_init(), signal
handlers are installed for SIGHUP, SIGINT, SIGQUIT, SIGBUS, SIGSEGV,
SIGPIPE, and SIGTERM (effectively, all the "fatal" signals).  they are
all caught with one signal handler, gdk_signal().  but if you take a
look at gdk_signal(), it really does nothing useful!

as it turns out, in my opinion it's better to *NOT* have gdk/gtk catch
any of these signals and just let the application go about as usual
(which will probably core dump, and then you can debug the core).  to
disable gdk/gtk's behavior, you need to do one of the following when
compiling gdk:

	1. #define I_NEED_TO_ACTUALLY_DEBUG_MY_PROGRAMS
	(there's actually a small/brief, one line note about this
	near the beginning of gdk.c)

	or

	2.run configure with "--enable-debug=yes" which will do:
	#define G_ENABLE_DEBUG

	or, instead of (re)compiling gdk/gtk:

	3. leave everything as normal, and redefine the signal
	handlers in your application.  for example:

		signal(SIGHUP, SIG_DFL);
		signal(SIGINT, SIG_DFL);
		signal(SIGQUIT, SIG_DFL);
		signal(SIGBUS, SIG_DFL);
		signal(SIGSEGV, SIG_DFL);
		signal(SIGPIPE, SIG_DFL);
		signal(SIGTERM, SIG_DFL);

i sent a message to this list a few weeks ago regarding this, but no
one responded.  sigh.
--andy



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