diff options
author | Victor Stinner <vstinner@redhat.com> | 2018-07-06 11:51:52 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-06 11:51:52 (GMT) |
commit | c2368cbc83ca2bafeaea0e4760be4996046d0444 (patch) | |
tree | e68abf5dc1a0a3299fda6763410cb41a300cda74 /Lib/multiprocessing/synchronize.py | |
parent | 6f19fc6d5607040ee36153a64a2ed004582af91f (diff) | |
download | cpython-c2368cbc83ca2bafeaea0e4760be4996046d0444.zip cpython-c2368cbc83ca2bafeaea0e4760be4996046d0444.tar.gz cpython-c2368cbc83ca2bafeaea0e4760be4996046d0444.tar.bz2 |
bpo-34054: multiprocessing uses time.monotonic() (GH-8118)
The multiprocessing module now uses the monotonic clock
time.monotonic() instead of the system clock time.time() to implement
timeouts.
Diffstat (limited to 'Lib/multiprocessing/synchronize.py')
-rw-r--r-- | Lib/multiprocessing/synchronize.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/multiprocessing/synchronize.py b/Lib/multiprocessing/synchronize.py index 038f73f..5137c49 100644 --- a/Lib/multiprocessing/synchronize.py +++ b/Lib/multiprocessing/synchronize.py @@ -15,8 +15,7 @@ import threading import sys import tempfile import _multiprocessing - -from time import time as _time +import time from . import context from . import process @@ -302,13 +301,13 @@ class Condition(object): if result: return result if timeout is not None: - endtime = _time() + timeout + endtime = time.monotonic() + timeout else: endtime = None waittime = None while not result: if endtime is not None: - waittime = endtime - _time() + waittime = endtime - time.monotonic() if waittime <= 0: break self.wait(waittime) |