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.
This commit is contained in:
Victor Stinner 2018-07-06 13:51:52 +02:00 committed by GitHub
parent 6f19fc6d56
commit c2368cbc83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 13 deletions

View file

@ -18,8 +18,8 @@ import sys
import threading
import array
import queue
import time
from time import time as _time
from traceback import format_exc
from . import connection
@ -1045,13 +1045,13 @@ class ConditionProxy(AcquirerProxy):
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)