Hi,
   While running the foll script by double-clicking it (under WinXP), it
runs as expected. However, when I run it via IDLE, it hangs after a few
secs (no runtime errors - just hangs). Why does this happen?

Cheers
Hans

import threading

class incr_num(threading.Thread):
    num = ''
    
    def __init__(self, local_num):
        global num
        threading.Thread.__init__(self)
        num = local_num
        print "__init__: ", num
        
    def run(self):
        global num
        for k in range (20):
            print "run: ", num
            num = num + 1

incr_num_thread = incr_num(501)
incr_num_thread.start()

print "Wait for thread to finish"
incr_num_thread.join()
print "Thread finished"

raw_input("Press enter")
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to