Author: techfox9

Basic threading in python ..

Wednesday, October 20th, 2010 @ 1:59 pm

The “main” script:

import threading
import someclass

csc = someclass.SomeClass()
csc_thread = threading.Thread(,args=())

The class used to run in a thread:

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]



Comments are closed.