Re: SIGINT with gtk_main
- From: Michiel Jan Laurens de Hoon <mdehoon c2b2 columbia edu>
- To: zz excite it
- Cc: gtk-app-devel-list gnome org
- Subject: Re: SIGINT with gtk_main
- Date: Wed, 21 Mar 2007 18:48:45 -0400
zz excite it wrote:
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);
}
Yes, but the problem is what to do with the /* Do something useful here */.
Because signal_handler can be called from any position in the code (for
example, it may be in the middle of a malloc), it's unsafe to do much
more inside signal_handler than to set a variable as a flag (I'm not
even sure if puts would be allowed inside signal_handler). And then the
question is how to let gtk_main know that the flag variable has changed.
--Michiel.
--
Michiel de Hoon
Center for Computational Biology and Bioinformatics
Columbia University
1130 St Nicholas Avenue
New York, NY 10032
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]