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

Ville M. Vainio vivainio at gmail.com
Mon Jul 20 06:28:33 EDT 2009


On Jul 20, 1:12 pm, Ville Vainio <vivai... at gmail.com> wrote:

> I imagine runshell() would be implemented in terms of QProcess, or
> subprocess.Popen/os.system and a worker thread.

Actually, the problem is that of general serialization of worker
thread operations. That is, it could be something akin to:

res = yield run_in_thread(lambda : os.system('make'))

run_in_thread would basically grab a worked thread, execute the
callable, and allow the generator to proceed after the thread is done.
Now, the only thing to do is the "generator dispatcher" in gui
mainloop that finds the correct generator and makes it proceed...



More information about the Python-list mailing list