I'm trying to add multithreading to a Python app, and thus started with some toy examples :
import threading
def myfunc(arg1, arg2):
print 'In thread'
print 'args are', arg1, arg2
thread = threading.Thread(target=myfunc, args=('asdf', 'jkle'))
thread.start()
thread.join()
This works beautifully, but as soon as I try to start a second thread, I get a RuntimeError :
import threading
def myfunc(arg1, arg2):
print 'In thread'
print 'args are', arg1, arg2
thread = threading.Thread(target=myfunc, args=('asdf', 'jkle'))
thread2 = threading.Thread(target=myfunc, args=('1234', '3763763é'))
thread.start()
thread2.start()
thread.join()
thread2.join()
As others seems to have no problem running this code, let me add that I am on Windows 7 x64 Pro with Python 2.6.3 32bits (if that matters).