Parent process also terminating after killing child process in SIGINT

Parent process also terminating after killing child process in SIGINT

Post by Chad » Sun, 29 Jul 2001 05:35:24



Ok. So, I am killing my child process when I press Ctrl-C. This works great
except for one odd problem. Unless I do something like a cout right before the
kill statement in my sigint_handler func, my parent all terminates immediately
with the message "Terminated" being displayed. Does anyone know any reason for
this?

Thank you,
Chad

 
 
 

1. Parent process also terminating after killing child process in SIGINT

I redirect the SIGINT signal then fork a new child process. I want the
sigint_handler function to kill the child when a Ctrl-C is pressed. It is
aware of the child's pid, because I make this (value fork returns) a global
variable. The problem is, in my sigint_handler func, I have kill(child_pid,
SIGTERM). For some stranger reason, my parent process is also Terminated and
the shell tells me so. However, if I put something like a cout right above
the
kill statement, only the child is killed and parent moves on with its other
functions. This is very strange and annoying to me. I just want the child to
die, not the parent too. Any ideas why this should happen and why the cout
changes the affect?

Thank you,
Chad

2. Problems with Linux and XFree86 3.1

3. Child process terminates when parent process killed

4. can't run emacs with Xfree86-3.1. Incompatible libraries

5. How can kill all child processes without killing parent process ?

6. xawTV Screen Ripping on SMP system

7. how to kill a child process that runs other children processes

8. Man page Reference to GCC, Make Doc

9. How to terminate a parent process after all its children are done?

10. Can a child process change the parent process's directory?

11. child process of parent process group

12. How does a parent process know his child process dead?

13. how does a parent process know his child process dead?