In Python threading, how I can I track a thread's completion?

前端 未结 7 1886
暖寄归人
暖寄归人 2020-12-19 04:52

I\'ve a python program that spawns a number of threads. These threads last anywhere between 2 seconds to 30 seconds. In the main thread I want to track whenever each thread

7条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-19 05:36

    You can let the threads push their results into a threading.Queue. Have another thread wait on this queue and print the message as soon as a new item appears.

提交回复
热议问题