import threading
import time
def test1():
print "hello"
time.sleep(15)
print "hello2"
def test2():
print "hi"
th1 =threading.Thread(test1())
th2 =threading.Thread(test2())
p=[th1,th2]
for i in p:
i.start()
for i in p:
i.join()
I am not sure if i am right, please correct me if I am not. I am expecting the output to be printed in this order hello hi and hello2. as i am expecting the two threads created to run parallely . but i am getting the below output, hello hello2 and hi. Thread2 is running only after completion of thread1. Am i doing anything wrong? or my understanding or threading wrong?
Thread()'s constructor.