[issue16853] add a Selector to the select module

Charles-François Natali report at bugs.python.org
Thu Sep 5 10:28:00 CEST 2013


Charles-François Natali added the comment:

> Giampaolo Rodola' added the comment:
>
> I have realized just now that at least epoll() and kqueue() selectors could take advantage and define their own modify() method (there was even a TODO I totally missed).

As a side note, in the general case, there's more than a performance
optimization: the problem with unregister() + register() vs a real
modify (e.g. EPOLL_CTL_MOD) is that it's subject to a race condition,
if an event fires during the short window where the FD isn't
registered anymore.

But since selectors use level-triggered notification, that's not an
issue: I'll probably add a comment in the code explaining why it's
safe, though.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16853>
_______________________________________


More information about the Python-bugs-list mailing list