#!/usr/bin/python
import thread
import time
# this is the function we are using for thread creation
def func(ThreadName,delay):
print("%s started its execution now"%(ThreadName))
count=0
while count<5:
count=count+1
print("Iteration no : %d"%int(count)+" Name :%s"%ThreadName +" Time :%s"%(time.ctime(time.time())))
time.sleep(delay)
print("------------- %s has now finished executing ---------------"%ThreadName)
# now we have to start threads that use this func() method
thread.start_new_thread(func,("FIRST THREAD",3))
thread.start_new_thread(func,("SECOND THREAD",5))
print(" ****************** All the tasks have finished executing *******************************")
while True:
pass