mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
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:
parent
6f19fc6d56
commit
c2368cbc83
5 changed files with 15 additions and 13 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue