Is kill function synchronous?

前端 未结 4 1316

Is the kill function in Linux synchronous? Say, I programatically call the kill function to terminate a process, will it return only when the inten

4条回答
  •  隐瞒了意图╮
    2021-01-07 19:36

    kill cannot be synchronous as it only sends a signal. The target process might ignore incoming signals (cf. SIG_IGN) so there's no guarantee regarding kill's effect.

    It shouldn't be difficult to make an experiment verifying this hypothesis. Start process A and make it handle SIGTERM with a 10 second sleep before dying. Then start process B, which delivers a SIGTERM to A and exits immediately.

提交回复
热议问题