Why would a kill -2 not work?
Chuck Swiger
cswiger at mac.com
Mon May 18 18:24:40 UTC 2009
Hi--
On May 18, 2009, at 9:23 AM, Peter Steele wrote:
> Under what circumstances might a "kill -2 nnn" not work. I have a
> Python app with a signal handler configured to catch INT signals. It
> seems to work fine, but we've recently noticed that after the app
> has run for a while the kill -2 no longer works. This seems pretty
> suspicious, perhaps indicating our app is misbehaving in some way.
> What might cause the signal handler to stop working?
The main reason might be that your process is already in another
signal handler or is otherwise blocked in a system call and won't get
the new signal until it completes the current situation.
The amount of stuff you're allowed to do safely in a signal handler is
pretty minimal-- you're better off setting a flag, returning from the
signal handler, and having the next run past the main event loop or
whatever check for the flag and handle things in a normal app
context. If you try to do anything involving malloc() or s/printf,
etc, you're running risks. "man sigaction" is likely to be
informative....
Regards,
--
-Chuck
More information about the freebsd-questions
mailing list