Pep 342 (val = yield MyGenerator(foo)), synchronous os.system() that doesn't block gui event loops

John Nagle nagle at animats.com
Tue Jul 21 12:48:38 EDT 2009


Ville Vainio wrote:
> Has anyone implementing something like what the subject line
> indicates?
> 
> The idea:
> 
> To run functions that execute a series of system commands without
> blocking the ui, *and* without adding state machine logic.

    At some level, there's going to be state machine logic.
You need interlocking so that the user can't initiate
simultaneous conflicting background operations from the GUI.

    The usual solution is to run the background operations
in another thread, and have them put events on a queue
read by the GUI task.

    You also have to work out how to cancel background operations,
if they're going to be as big as a "make".

    Here's the very first application which did this sort of thing,
running commands in multiple threads without blocking the user
interface thread.  This is from 1972.

    http://www.fourmilab.ch/documents/univac/fang/

    And yes, it did properly interlock everything it was
doing in the background.

				John Nagle



More information about the Python-list mailing list