mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #20311: EpollSelector now also rounds the timeout towards zero, as
PollSelector. This change is not really required in Python 3.4, since select.epoll.poll() now rounds also correctly the timeout. But Guido van Rossum prefers to have exactly the same selectors.py file in CPython and Tulip projects: "it's not harmful".
This commit is contained in:
parent
2d854c8e7b
commit
567b26e882
1 changed files with 8 additions and 1 deletions
|
@ -411,7 +411,14 @@ if hasattr(select, 'epoll'):
|
|||
return key
|
||||
|
||||
def select(self, timeout=None):
|
||||
timeout = -1 if timeout is None else max(timeout, 0)
|
||||
if timeout is None:
|
||||
timeout = -1
|
||||
elif timeout <= 0:
|
||||
timeout = 0
|
||||
else:
|
||||
# epoll_wait() has a resolution of 1 millisecond, round away
|
||||
# from zero to wait *at least* timeout seconds.
|
||||
timeout = math.ceil(timeout * 1e3) * 1e-3
|
||||
max_ev = len(self._fd_to_key)
|
||||
ready = []
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue