【发布时间】:2017-02-05 13:01:20
【问题描述】:
如果 Python threading.Thread 不再有任何引用但它仍在运行,它是否会被垃圾回收?
# Start a thread with no reference
Thread(target=some_long_running_function).start()
# Do lots of other stuff
【问题讨论】:
-
我对Python一无所知,但是如果一个running线程突然消失就很奇怪了。单线程应用中的主线程呢,你是不是一直保持着对它的引用呢?
标签: python multithreading garbage-collection