This is my code and I am getting varied output.
import threading
import time
def th_fun(limit,sleeptime):
print '%s' % (limit)
print '%s number of threads are active' % (threading.activeCount())
time.sleep(sleeptime)
if __name__ == '__main__':
for i in range(5):
t = threading.Thread(target = th_fun , args = (i,1))
t.start()
Can someone tell when a thread becomes inactive? My understanding is that 5 different thread objects are created and run and as soon as time.sleeptime() is executed it becomes inactive.