SIGCONT occurs after a SIGTERM

Richard M. Mathews richard at locus.com
Tue Feb 12 15:40:28 AEST 1991


coleman at cam.nist.gov (Sean Sheridan Coleman X5672) writes:

>Please explain to me why a SIGCONT is sent to a process after
>SIGTERM is sent to my process. It doesn't compute because TERM
>means to terminate the the process. I catch SIGCONT because I 
>do some reconnecting for serial drivers after my process is
>stopped from a cntl-Z. Below is a piece of the code and a
>some output from the program. 

This is yet another example of C Shell brain damage.  The shell thinks
it is going to do you a favor.  When it sends SIGTERM or SIGHUP it follows
it with a SIGCONT.  The "problem" that the shell is trying to solve is
that a signal sent to a stopped process won't get processed until the
process resumes -- since you apparently wanted the process to die, the
shell sends a SIGCONT just to make sure the process will be able to get
to your signal right away.  Wrong answer.  It doesn't solve the problem
in general for all signals, and it creates about as much confusion as
it tries to avoid.

The solution is don't catch SIGCONT.  Your SIGTSTP handler knows when
the program resumes anyway because the line after the "kill" which
caused it to suspend itself will not be reached until the program is
resumed.  Taking the code you have for SIGCONT, and putting it there
is the "normal" way to do things.

Richard M. Mathews			 Freedom for Lithuania
richard at locus.com				Laisve!
lcc!richard at seas.ucla.edu
...!{uunet|ucla-se|turnkey}!lcc!richard



More information about the Comp.unix.questions mailing list