Author: techfox9
Basic threading in python ..
Wednesday, October 20th, 2010 @ 1:59 pm
The “main” script:
# ttest.py import threading import someclass csc = someclass.SomeClass() csc_thread = threading.Thread(target=csc.run,args=()) csc_thread.start()
The class used to run in a thread:
# someclass.py class SomeClass: def __init__(self): print "init" def run(self): # import pdb # pdb.set_trace() # trigger debugger for ix in range(1,10): print "run %d" % ix
To run it:
python [-m pdb] ttest.py