> It kinda depends what your thread is doing, and what technique you are 
> using to keep it alive, but one possibility is to do something like:
>
> class Worker(threading.Thread):
>    def run(self):
>        self.running = True
>        while(self.running):
>            # do stuff
>
>    def stop(self):
>        self.running = False
>
> In this case, the you call .stop() on your Worker object, and the thread 
> will exit when it next gets to the top of the while loop.


Hi Jeff,

Another variation of this is in here:

     http://mail.python.org/pipermail/tutor/2006-January/044557.html

Some of the method names in that old message are badly named, but I hope 
its ideas are clear.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to