如果不再有任何对Python threading.Thread的引用,但它仍然在运行,它会被垃圾收集吗?
# Start a thread with no reference
Thread(target=some_long_running_function).start()
# Do lots of other stuff发布于 2017-02-23 23:49:08
我相信线程模块在线程运行时包含对线程的引用,然后在thread run()方法完成后进行清理。我不能评论模块的内部结构以及它是如何实现的,但是我相信这些引用(对活动线程的引用)可以通过threading.enumerate()访问。
https://stackoverflow.com/questions/42052356
复制相似问题