I'm not sure I see a problem using: threading.activeCount ()
to track the number of threads that are still active?
Even if you do not know how many threads you are going to start before starting, it is quite easy to track. I usually generate thread collections through list comprehension, then a simple comparison using activeCount with the size of the list can tell you how many of them ended.
See here: http://docs.python.org/library/threading.html
Alternatively, if you have stream objects, you can simply use the .isAlive method on stream objects to check.
I just checked by throwing this into the multi-threaded program that I have, and it looks fine:
for thread in threadlist: print(thread.isAlive())
Gives me a True / False list when threads turn on and off. So you have to do this and check for something False to find out if any thread has completed.
Ezekiel kruglick
source share