发送信号给进程后,有没有一种方法可以等待一段时间?

huangapple go评论83阅读模式
英文:

Is there a way to wait after sending a signal to a process?

问题

当一个信号(比如os.Interrupt)被发送给一个[进程]时,进程会等待直到完成进程吗?还是我们需要等待一段时间后才能继续?

英文:

When a signal (like os.Interrupt) is sent to a process, does the process waits until finish the process? Or, do we have to wait some time after?

答案1

得分: 0

我认为你在问发送信号是否会等待进程完成?

答案是这取决于平台和发送的信号类型以及进程对信号的处理方式。一些信号(如Kill)无法被捕获,会导致进程终止。其他信号在进程不处理它们时不会产生任何效果。还有一些信号,如果进程不处理它们,会有一些默认操作,但进程也可以根据需要处理它们以执行不同的操作。在我了解更多关于你的问题之前,这是我能给出的最好答案。

英文:

I think you are asking if sending a signal will wait till the process is finished?

The answer is that it depends on the platform and the type of signal you send and what the process does with the signal. Some signals such as Kill can't be caught and will cause the process to terminate. Others don't do anything unless the process handles them. Still others will do something if the process doesn't handle them but the process can handle it if it want's to do something different. Until I know more about what you are asking this is the best answer I can give.

答案2

得分: 0

你必须等一会儿(或者很长时间,甚至可能是永远,这取决于信号的处理方式)。

英文:

You have to wait a moment (or a long time, maybe even forever, depending on how the signal is being handled).

huangapple
  • 本文由 发表于 2012年6月26日 06:38:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/11198387.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定