[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: SIGINT with gtk_main
- From: Chris Vine <chris cvine freeserve co uk>
- To: gtk-app-devel-list gnome org
- Subject: Re: SIGINT with gtk_main
- Date: Thu, 22 Mar 2007 23:14:59 +0000
On Wednesday 21 March 2007 20:59, zz excite it wrote:
[snip]
> Hi,
>
> maybe adding this to main
>
> /*signal(SIGHUP,SIG_IGN); */ /* ignore SIGHUP */
> /*signal(SIGTERM,signal_handler);*/ /* catch SIGTERM */
> signal(SIGINT,signal_handler); /* catch SIGINT */
>
>
> and using this handler
>
> static void signal_handler(int sig) __attribute__(( __noreturn__ ));
> static void signal_handler(int sig)
> {
> switch (sig) {
> case SIGINT:
> puts("SIGINT signal catched");
> break;
> case SIGTERM:
> puts("SIGTERM signal catched");
> break;
> }
> /* Do something useful here */
> exit(EXIT_FAILURE);
> }
As puts() is not guaranteed to be async-signal-safe, this is undefined
behaviour.
Chris
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]