
On Sat, Nov 3, 2012 at 3:06 PM, Guido van Rossum guido@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).
-Ben
--Guido
On Sat, Nov 3, 2012 at 2:20 PM, Richard Oudkerk shibturn@gmail.com wrote:
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"
classes
with "proactor" classes for select(), poll(), epoll() and IOCP. See
https://bitbucket.org/sbt/tulip-proactor/changeset/c64ff42bf0f2679437838ee77...
The IOCP proactor does not support ssl (or ipv6) so main.py does not
succeed
in downloading from xkcd.com using ssl. Using the other proactors it
works
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
true
if there are any outstanding operations registered with the proactor.
You
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@python.org http://mail.python.org/mailman/listinfo/python-ideas
-- --Guido van Rossum (python.org/~guido) _______________________________________________ Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas