hmmmm, ok, well that is what I am currently doing but something is causing it to continue... guess I have some digging around to do. thanks for the help!

Jeff

John Fouhy <[EMAIL PROTECTED]> wrote:
On 16/08/06, Jeff Peery <[EMAIL PROTECTED]> wrote:
> hello, how do I stop a thread? do I need to kill it or can I simply call a
> stop function... kinda like the start function? I read a bit on google and
> it sounded like using a kill isn't recommended for some reason... so how is
> this thing stopped? thanks!

The only good way for a thread to stop is for its run() method to exit.

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.

--
John.


Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1ยข/min.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to