[issue16853] add a Selector to the select module
Richard Oudkerk
report at bugs.python.org
Thu Sep 5 15:09:02 CEST 2013
Richard Oudkerk added the comment:
On 05/09/2013 9:28am, Charles-François Natali wrote:
> 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.
Even with edge-triggered notification, doesn't registering an fd check
the current readiness:
>>> import os, select
>>> r, w = os.pipe()
>>> p = select.epoll()
>>> os.write(w, b"h")
>>> p.register(r, select.EPOLLIN | select.EPOLLET)
>>> p.poll(0)
[(3, 1)]
>>> p.poll(0)
[]
Otherwise it would be very difficult to edge-triggered notification.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16853>
_______________________________________
More information about the Python-bugs-list
mailing list