wxPython and threading issue

Patrick Smith smith.patrick__NOSPAM__ at gmail.com
Fri Sep 29 10:31:52 EDT 2006


> Well, the problem is that you can't simply kill a thread--it shares
> memory with other threads that it could be leaving in an inconsistent
> state.  Imagine that it was, say, holding a lock when it was forceably
> killed.  Now any other thread that tries to acquire that lock will
> block forever.
>
> You really do need the thread's cooperation so that it only exits when
> everything is in a kosher state.  Can you dig into the incredibly long
> function and change it to do the flag-checking and exiting safely?
>
> I second the notion to consider using subprocesses instead of threads;
> that's almost always a good idea unless you're really sharing a lot of
> complex data structures.
>

Hi,
Thanks again for your replies.

The way this was originally working was actually using a subprocess,
however, the people who this program is for were having problems that when
the application was closed, the subprocess was still around in the system,
which was why they wanted the other module it is using to have a function it
could call, rather then using popen on the main method.

Also, the people who I am doing this for need something ASAP and for now are
fine with the cancel button completely closing the entire program.  Is there
at least a nice way to do this?

Thanks for all your replies,they've all been very helpful.





More information about the Python-list mailing list