How to make child process die after parent exits?

后端 未结 24 2296
天涯浪人
天涯浪人 2020-11-22 05:31

Suppose I have a process which spawns exactly one child process. Now when the parent process exits for whatever reason (normally or abnormally, by kill, ^C, assert failure o

24条回答
  •  天命终不由人
    2020-11-22 06:20

    I think a quick and dirty way is to create a pipe between child and parent. When parent exits, children will receive a SIGPIPE.

提交回复
热议问题