On Mon, Sep 22, 2014 at 9:43 PM, Nicholas Cannon
<nicholascann...@gmail.com> wrote:
> Or can I safely stop the running threads and make them drop everything error 
> free?

This would be what I'd recommend. If someone wants to close your
program, s/he should be allowed to - imagine if internet traffic is
costly [1] and the query was done accidentally. So what you need is to
have the shutdown divided into three steps:

1) Close the window, or at least show visually that it's shutting down.
2) Send a signal to the worker threads
3) When the worker threads all shut down, terminate the program.

You can handle step 3 simply by ensuring that the threads aren't
marked as daemons. Python won't shut down until they're all gone. Step
1 is, I suspect, already happening. So all you need to do is message
the worker thread - and that can be done simply by setting a global
variable or something.

However, I'm not seeing any use of threads in your code. What thread
is being cut off? What's the error you're seeing?

ChrisA

[1] "costly" might not mean money, although it can. But imagine you're
on a slow connection and you can't afford to have other programs
lagging out something that's important.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to