shawn bright wrote: > hello there all, > > i have a python reference book that got me started knowing how to use > threads, i can declare one as a class, and start it like this > > class SomeThread(threading.Thread): > > > run_process = SomeThread() > run_process.start() > > but how do i kill it ? This part is not in my book. Basically the thread > works, and runs in a while loop. Is there a way to destroy the instance > of it after creation ?
A thread dies when it's run() method exits, so you have to contrive a way to make run() exit. The usual way is to set a flag that the thread checks. Here is an example using a threading.Event as a flag: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65448 Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor