catching unix signals from Gtk



Hi all; here's a problem I can't find a solution to in any of the
docs nor by searching the email database.

How can a Gtk-based application respond to unix signals?

In particular, I have an app that may receive a SIGUSR1 from another
program which tells my app to re-read some files and update its
display.

I could write an ordinary unix signal handler and register it
with signal(2), but it's not safe to call GTK functions from
within such a handler.

I could write an ordinary unix signal handler and have it set
a flag, and then use a timer callback to poll that flag once
a second or so.  But I don't want to keep a timer running for
an event that happens only rarely.

I could open a pipe and have the unix signal handler write a
single byte to it when there's an interrupt, and then have
GTK attach an input handler to the output side of the pipe.


These all seem to be kludges to me; is there a better way to
do it?

	-ed falk



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