Re: Thread handling issue
- From: Tim Golden <mail@xxxxxxxxxxxxxxx>
- Date: Fri, 07 Oct 2011 09:45:38 +0100
On 07/10/2011 09:29, Paul wrote:
I'm wondering what the best solution for this problem is.
I've got a wxpython app, in one part a user makes some selections then opens a
dialog to select where to output. At which point the app starts a thread
processing their selection while they're choosing an output location, hopefully
ready for when they're done.
My problem is if the user doesn't select an output location and cancels the
dialog to go back to the selection I want to terminate the thread to avoid the
user opening and closing the output selection firing off a ton of threads.
As there's no inbuilt way of killing threads I was wondering the best way to
The most common approach is to have the thread monitor an event which is
set if, for example, the user cancels. The thread may of course have to
wait, for example, for a long-running database query to complete before
it can discover that its time has been wasted :)
The exact mechanism will depend on how your code is structured,
what the thread is doing, and how it's passing anything back
to the main thread.
- Prev by Date: Re: How to inspect slot wrappers arguments in Python?
- Next by Date: Re: sending ftp file list to mail???
- Previous by thread: Thread handling issue
- Next by thread: Re: Thread handling issue