On Fri, Jun 6, 2008 at 10:30 PM, John Dohn <[EMAIL PROTECTED]> wrote:

> Hi there,
>
> How can I kill a threading.Thread subclass from MainThread?


At the end I did:

        def run(self):
                while True:
                        if exit_event.isSet():
                                # Thread exiting
                                return
                        try:
                                data = q_in.get(timeout = .5)
                        except Queue.Empty:
                                continue
                        # ... process data

And then in the MainThread I do exit_event.set() and wait for all threads to
exit. It's a pretty awkward solution but works.

BTW Guys, is something like Thread.kill() planned for the future? Or is
there a reason not to have it?

Thanks

JD
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to