RE: SIGINT with gtk_main
- From: "Michiel De Hoon" <mdehoon c2b2 columbia edu>
- To: "Chris Vine" <chris cvine freeserve co uk>, <gtk-app-devel-list gnome org>
- Subject: RE: SIGINT with gtk_main
- Date: Mon, 26 Mar 2007 19:59:44 -0400
For my application, I need to run gtk_main but I want to quit gtk_main
when either input is available on stdin or the user presses Ctrl-C. ...
Chris wrote:
You can write to a pipe in the signal handler (assuming you are using Unix
as
your question implies), as write() is async-signal-safe - but set the pipe
non-blocking as in the unlikely event of it filling up and blocking on
write
you will deadlock the program. You can watch on the pipe in the main loop
using GIOChannel.
Thanks! That works fine (I tried this on Linux and Mac OS X).
Does it matter if I'd be using Windows instead? It's a bit hard to try
because of some DLL incompatibilities, but that can be resolved. Or is there
some fundamental reason why this wouldn't work on Windows? My previous
solution
checking for an interrupt periodically seems to work fine on Windows, though
it
is of course hard to tell with async signals.
Thanks again,
--Michiel.
Michiel de Hoon
Center for Computational Biology and Bioinformatics
Columbia University
1150 St Nicholas Avenue
New York, NY 10032
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]