Any other Python flaws?
Paul Prescod
paulp at ActiveState.com
Fri Jun 15 18:54:33 EDT 2001
Mitch Chapman wrote:
>
>...
>
> I need to manage long-running, parameter-rich computations from
> GUI applications while still responding to the user. I think I
> need threads because they make it easier to exchange all of those
> parameters between the GUI controller and the background computation
> than do separate processes. I think I need processes because I
> need to be able to cancel the background computation.
When I need to do something like that I do this:
while not self._cancel:
do_more_computation()
Then I let the controller thread flick the do_more_computation switch.
This is not convenient but it not as inconvenient as separate processes.
Even if it takes a second for the UI to tell the background process to
halt, that is better than hanging the *entire UI* for a second at a
time.
--
Take a recipe. Leave a recipe.
Python Cookbook! http://www.ActiveState.com/pythoncookbook
More information about the Python-list
mailing list