gpt4 book ai didi

.net - Process.Kill 后是否需要使用 Process.WaitForExit?

转载 作者:行者123 更新时间:2023-12-04 06:35:19 27 4
gpt4 key购买 nike

Process.Kill 后是否需要使用 Process.WaitForExit?
如果调用进程在调用 Process.Kill 后立即退出怎么办?
这会导致 Process.Kill 失败吗?

编辑:我需要在退出我的应用程序时终止一个进程。在这一点上,我不打算处理 kill 失败的情况,因此我没有必要等待进程退出。因此,如果不需要调用 WaitForExit,我可以跳过它。

最佳答案

根据documentation on MSDN (强调我的)

Note The Kill method executes asynchronously. After calling the Kill method, call the WaitForExit method to wait for the process to exit, or check the HasExited property to determine if the process has exited.



如果你不需要等待,或者如果你不需要确定进程是否真的存在,那么我想你不需要调用 WaitForExit或查看 HasExited .

关于.net - Process.Kill 后是否需要使用 Process.WaitForExit?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7078440/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com