i am learning multi-threading in python and used following code from the following link.
http://www.tutorialspoint.com/python/python_multithreading.htm
The Pythonwin IDE hangs (not responding) for more than 30 min, Please help me if there is some problem in the code.
import thread
import time
# Define a function for the thread
def print_time( threadName, delay):
count = 0
while count < 5:
time.sleep(delay)
count += 1
print "%s: %s" % ( threadName, time.ctime(time.time()) )
# Create two threads as follows
try:
thread.start_new_thread( print_time, ("Thread-1", 2, ) )
thread.start_new_thread( print_time, ("Thread-2", 4, ) )
except:
print "Error: unable to start thread"
while 1:
pass