如何查看线程是否已完成?我尝试了以下操作,但 threads_list 不包含已启动的线程,即使我知道该线程仍在运行。
import thread
import threading
id1 = thread.start_new_thread(my_function, ())
#wait some time
threads_list = threading.enumerate()
# Want to know if my_function() that was called by thread id1 has returned
def my_function()
#do stuff
return