Python多处理中Process.terminate()和Process.kill()之间的区别是什么?

2024-04-23 16:03:25 发布

您现在位置:Python中文网/ 问答频道 /正文

Python多处理中Process.terminate()Process.kill()之间有什么区别


Tags: processkill区别terminate
1条回答
网友
1楼 · 发布于 2024-04-23 16:03:25

terminate()向进程发送SIGTERM信号

terminate():
    Terminate the process. On Unix this is done using the SIGTERM signal; on Windows TerminateProcess() is used. Note that exit handlers and finally clauses, etc., will not be executed.

kill()向进程发送SIGKILL信号

kill():
Same as terminate() but using the SIGKILL signal on Unix.

进程如何处理这些信号取决于它。通常,SIGTERM是优雅的关闭,而SIGKILL更像是中止More details

相关问题 更多 >