Last week I received this query from my colleague and the explanation was this:
Its common practice that, making the main thread wait for the threads ‘started’ by it . Its done with .join() method of ‘Thread’ class from ‘threading’ module. How-ever, sometimes, instead of waiting ‘indefinitely’ for the thread to join , most use a timeout value in join. But it does not guarantee that, the ‘thread’ is alive or not even after hitting the timeout. To check the threads ‘aliveness’ you can use ‘t.isAlive()’ method which wil return ‘true’ if its ‘alive..
For ex:
>for th in threads:
th.join (30)
if not th.isAlive():
logging.info ('Thread : %s terminated' % (th.getName()))
else:
logging.debug( 'Thread is still alive.' )
.................