Hi @Suresh_K_L, Thanks for reaching out to us.
In python2 if you run the example threading-start.py multiple times, you will notice that the output might be different each time. If you specifically expected any one of the outputs each time, then you forgot that there is no guarantee regarding the order of execution for the threads. Once started, the threads join: the main thread waits for the second thread to complete by calling its join
method. Using join
is handy in terms of not leaving any threads behind.
If you do not join all your threads and wait for them to finish, it is possible that the main thread finishes and exits before the other threads. If this happens, your program will appear to be blocked and will not respond to even a simple KeyboardInterrupt signal. However, in Python 3, the threading effect is not easily observable using small-scale examples.
Hope this helps.
Happy learning