I have written very basic python code for threading...
import time
import thread
def print_hello(name,delay):
while 1:
print name
time.sleep(delay)
try:
thread.start_new_thread(print_hello, ("frist",1,))
thread.start_new_thread(print_hello, ("second",2,))
except:
print "unable to start thread"
time.sleep(4)
print "hello"
which output is:
second
frist
frist
second
frist
frist
hello
Exception:
Unhandled exception in thread started by
sys.excepthook is missing
lost sys.stderr
Unhandled exception in thread started by
sys.excepthook is missing
lost sys.stderr
my query is:
- why second coming 1st?
- why the exception?