当它的父线程死了时,线程会死吗?
Does a thread die when its parent is dead?
当我杀死启动它的程序后,线程会死掉吗?
可能和我的英文有关,但是我在这里找不到:
是的,当一个进程 killed (e.g. by sending it SiGKILL
) 时,它的所有线程都会被终止。
值得注意的是,这不是 Python 特定的。
好像是this is the part of the documentation you're looking for,上面写着:
When the main thread exits, it is system defined whether the other threads survive. On SGI IRIX using the native thread implementation, they survive. On most other systems, they are killed without executing try ... finally clauses or executing object destructors.
所以这是 Python 没有定义的东西 - 它可以根据特定的 OS.
当我杀死启动它的程序后,线程会死掉吗?
可能和我的英文有关,但是我在这里找不到:
是的,当一个进程 killed (e.g. by sending it SiGKILL
) 时,它的所有线程都会被终止。
值得注意的是,这不是 Python 特定的。
好像是this is the part of the documentation you're looking for,上面写着:
When the main thread exits, it is system defined whether the other threads survive. On SGI IRIX using the native thread implementation, they survive. On most other systems, they are killed without executing try ... finally clauses or executing object destructors.
所以这是 Python 没有定义的东西 - 它可以根据特定的 OS.