是杀功能同步? [英] Is kill function synchronous?

查看:111
本文介绍了是杀功能同步?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Linux的同步功能?我说,我编程调用函数终止一个进程,它会返回只有当预期的过程被终止,或者它只是将信号发送和返回。如果是这样的话,我怎么可以让它等待被杀害预期的过程吗?

Is the kill function in Linux synchronous? Say, I programatically call the kill function to terminate a process, will it return only when the intended process is terminated, or it just sends the signal and return. If that is the case, how can I make it wait for the intended process to be killed?

推荐答案

没有,因为它不杀生,只发出了一个信号的过程。

No, since it doesn't kill anything, it only sends a signal to the process.

在默认情况下该信号甚至可以阻止或忽略。

By default this signal can even be blocked or ignored.

您不能阻止杀死-9 从而重新presents发送 SIGKILL

You can't block kill -9 which represents sending SIGKILL

要等待的过程中死亡:

while kill -0 PID_OF_THE_PROCESS 2>/dev/null; do sleep 1; done

这篇关于是杀功能同步?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆