Reputation: 253
I am new to threading (though not a beginner in Python) and I am having trouble making a thread work. I have the following simpl(est) program, but I cannot seem to get the function do_something() called. I must be doing something very basic wrong. Can anyone tell me what? Thanks a ton!
import threading
def do_something():
print 'Function called...'
t = threading.Thread(target=do_something)
Of course, I had unwittingly previously deleted the t.start() instruction (Damn you Synaptic touchpad!!!!!!)
Upvotes: 0
Views: 104
Reputation: 4987
You should start the thread:
import threading
def do_something():
print 'Function called...'
t = threading.Thread(target=do_something)
t.start() # you forgot this line
Upvotes: 5