Re: [PATCH] x86_64: fix delayed signals

Linus Torvalds
2008-07-12T17:43:05Z

On Sat, 12 Jul 2008, Andi Kleen wrote:
>
> Linus, the fact that is not explained by your theory is why
> Ctrl-Z+kill works but Ctrl-C doesn't.

Umm. Read the reports more carefully. Many of the complaints are about ^Z
too.

More-over, ^Z and ^C are very different from an app standpoint. A _lot_ of
applications block or catch ^C (SIGINT), while doing the same for ^Z
(SIGTSTP) and SIGTERM is much less common (but possible: a tty sends
SIGTSTP, which is blockable, not SIGSTOP, which is not).

The reason? It's quite common to catch ^C in order to do cleanup. The
common handler case is that you catch SIGINT, do cleanup, and then kill
yourself with SIGINT in order to make it _look_ like you reacted directly
to the ^C.

So there are a _lot_ of loads where ^C will not kill things immediately,
but ^Z + SIGKILL (or SIGTERM, the default for "sig") will.

Try doing a "yum update", for example.

Or use 'git', for that matter. git does exactly that kind of thing:
catches SIGINT and removes temp-files etc. But if you kill it manually
using some "stronger" signal (and using ^Z to get the shell back before
you do that is obviously one way), that won't happen.

And trust me, git is not at all unusual in this respect.

Linus