summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-02-10 22:42:32 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-02-10 22:42:32 (GMT)
commited1654fa3ea1c05c7397334b09396675f3c3aeaf (patch)
tree6768041fc264a2adbc5cb46db587beee2bb794f4 /Lib/asyncio
parentb38b5c43c710da8fd6034d1dab631c5b020652bf (diff)
downloadcpython-ed1654fa3ea1c05c7397334b09396675f3c3aeaf.zip
cpython-ed1654fa3ea1c05c7397334b09396675f3c3aeaf.tar.gz
cpython-ed1654fa3ea1c05c7397334b09396675f3c3aeaf.tar.bz2
Issue #20505: BaseEventLoop uses again the resolution of the clock to decide if
scheduled tasks should be executed or not.
Diffstat (limited to 'Lib/asyncio')
-rw-r--r--Lib/asyncio/base_events.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py
index 4207a7e..377ea21 100644
--- a/Lib/asyncio/base_events.py
+++ b/Lib/asyncio/base_events.py
@@ -96,6 +96,7 @@ class BaseEventLoop(events.AbstractEventLoop):
self._default_executor = None
self._internal_fds = 0
self._running = False
+ self._clock_resolution = time.get_clock_info('monotonic').resolution
def _make_socket_transport(self, sock, protocol, waiter=None, *,
extra=None, server=None):
@@ -643,10 +644,10 @@ class BaseEventLoop(events.AbstractEventLoop):
self._process_events(event_list)
# Handle 'later' callbacks that are ready.
- now = self.time()
+ end_time = self.time() + self._clock_resolution
while self._scheduled:
handle = self._scheduled[0]
- if handle._when > now:
+ if handle._when >= end_time:
break
handle = heapq.heappop(self._scheduled)
self._ready.append(handle)