[Python-ideas] Tulip patches

Felipe Cruz felipecruz at loogica.net
Fri Dec 21 19:09:05 CET 2012


Hi!

I've been working in some tests to the pollers (Kqueue, Epoll ..) that may
interest you guys.. My goal is to create test cases for each poller
situation (ie: how to detect client disconnection with epoll and unix
pipes? or tcp sockets..) and understand how all those pollers are different
from each other and how we can map a generic events with all those possible
underlying implementations.

I already  did some Epoll and Kqueue tests here:
https://bitbucket.org/felipecruz/tulip/commits

best regards,
Felipe Cruz


2012/12/21 Guido van Rossum <guido at python.org>

> On Fri, Dec 21, 2012 at 7:57 AM, Guido van Rossum <guido at python.org>
> wrote:
> > On Fri, Dec 21, 2012 at 6:31 AM, Geert Jansen <geertj at gmail.com> wrote:
> >> Please find attached 4 patches:
> >>
> >> 0001-run-fd-callbacks.patch
> >>
> >> This patch will run callbacks for readers and writers in the same loop
> >> iteration as when the fd got ready. Copying from my previous email,
> >> this is to support the following idiom:
> >>
> >>     # handle_read() sets the "ready" flag
> >>     loop.add_reader(fd, handle_read)
> >>     while not ready:
> >>         loop.run_once()
> >>
> >> The patch currently dispatches callbacks twice in each iteration, once
> >> before blocking and once after. I tried to dispatch only once after
> >> blocking, but this made the SSL transport test hang. The reason is
> >> that the create_transport task is scheduled with call_soon(), and only
> >> when the task first runs, a file descriptor is added. So unless you
> >> dispatch before blocking, this task will never get started.
> >
> > Interesting. Go ahead and submit.
>
> Whoa! I just figured out the problem. You don't have to run the ready
> queue twice. You just have to set the poll timeout to 0 if there's
> anything in the ready queue. Please send me an updated patch before
> submitting.
>
> --
> --Guido van Rossum (python.org/~guido)
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20121221/48a81f49/attachment.html>


More information about the Python-ideas mailing list