[Python-Dev] Twisted Isn't Specific (was Re: Trial balloon: microthreads library in stdlib)
"Martin v. Löwis"
martin at v.loewis.de
Thu Feb 15 08:12:56 CET 2007
Thomas Wouters schrieb:
> If all (or all-but-one) of them have a 'run one iteration' method, you
> can call that from the 'main' mainloop.
That doesn't really work (and neither do variations involving coroutines.
Either the 'run one iteration' method blocks until one even arrives,
in which case it may block for a long time while other loops have
events pending (which then won't get processed).
Or each 'run one iteration' method has a polling mode (e.g. with
a time-out), in which case you get busy wait (you can fiddle with
the time-out value to trade business vs. responsiveness).
The 'run one iteration' approach doesn't support writing applications
that are single-threaded, responsive, and idle when there is nothing
to do. I can't believe that coroutines help in any way here.
Regards,
Martin
More information about the Python-Dev
mailing list