[Python-ideas] The async API of the future
ben at bendarnell.com
Sun Nov 4 17:00:33 CET 2012
On Sat, Nov 3, 2012 at 3:06 PM, Guido van Rossum <guido at python.org> wrote:
> FWIW, I've been studying other event loops. It's interesting to see
> the similarities (and differences) between e.g. the tulip eventloop,
> pyftpd's ioloop, Tornado's IOLoop, and 0MQ's IOLoop. The latter two
> look very similar, except that 0MQ makes the poller pluggable, but
> generally there are lots of similarities between the structure of all
> four. Twisted, as usual, stands apart. :-)
Pyzmq's IOLoop is actually a fork/monkey-patch of Tornado's, and they have
the same pluggable-poller implementation (In the master branch of Tornado
it's been moved to the PollIOLoop subclass).
> On Sat, Nov 3, 2012 at 2:20 PM, Richard Oudkerk <shibturn at gmail.com>
> > On 02/11/2012 11:59pm, Guido van Rossum wrote:
> >> Working code or it didn't happen. (And it should scale too.)
> > I have some (mostly) working code which replaces tulip's "pollster"
> > with "proactor" classes for select(), poll(), epoll() and IOCP. See
> > The IOCP proactor does not support ssl (or ipv6) so main.py does not
> > in downloading from xkcd.com using ssl. Using the other proactors it
> > correctly.
> > The basic interface for the proactor looks like
> > class Proactor:
> > def recv(self, sock, n): ...
> > def send(self, sock, buf): ...
> > def connect(self, sock, address): ...
> > def accept(self, sock): ...
> > def poll(self, timeout=None): ...
> > def pollable(self): ...
> > recv(), send(), connect() and accept() initiate io operations and return
> > futures. poll() returns a list of ready futures. pollable() returns
> > if there are any outstanding operations registered with the proactor.
> > use a pattern like
> > f = proactor.recv(sock, 100)
> > if not f.done():
> > yield from scheduling.block_future(f)
> > res = f.result()
> > --
> > Richard
> > _______________________________________________
> > Python-ideas mailing list
> > Python-ideas at python.org
> > http://mail.python.org/mailman/listinfo/python-ideas
> --Guido van Rossum (python.org/~guido)
> Python-ideas mailing list
> Python-ideas at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas