diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-01-25 13:43:45 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-01-25 13:43:45 (GMT) |
commit | 2041859f279423c06a707899b4a66e3f0aba3dfb (patch) | |
tree | efc451d36c521f99174c6bc4689bc14e0afc1f8e /Lib/selectors.py | |
parent | 38c72bd1996164a6f3f90df998f0b9627b07138a (diff) | |
download | cpython-2041859f279423c06a707899b4a66e3f0aba3dfb.zip cpython-2041859f279423c06a707899b4a66e3f0aba3dfb.tar.gz cpython-2041859f279423c06a707899b4a66e3f0aba3dfb.tar.bz2 |
Issue #20311: Revert e042ea77a152 and 7ce7295393c2, PollSelector.select() and
EpollSelector.select() round again the timeout towards zero
Diffstat (limited to 'Lib/selectors.py')
-rw-r--r-- | Lib/selectors.py | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/Lib/selectors.py b/Lib/selectors.py index 1bdf972..cd8b29e 100644 --- a/Lib/selectors.py +++ b/Lib/selectors.py @@ -8,7 +8,6 @@ This module allows high-level and efficient I/O multiplexing, built upon the from abc import ABCMeta, abstractmethod from collections import namedtuple, Mapping import functools -import math import select import sys @@ -357,9 +356,8 @@ if hasattr(select, 'poll'): elif timeout <= 0: timeout = 0 else: - # poll() has a resolution of 1 millisecond, round away from - # zero to wait *at least* timeout seconds. - timeout = int(math.ceil(timeout * 1e3)) + # Round towards zero + timeout = int(timeout * 1000) ready = [] try: fd_event_list = self._poll.poll(timeout) @@ -415,10 +413,6 @@ if hasattr(select, 'epoll'): 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: |