diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-09-02 23:18:25 +0200 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-09-02 23:18:25 +0200 |
commit | ae58649721ec898ea4a101b0861e16fff3511cfa (patch) | |
tree | bb08b1a9b5f354212d7ca365d76659b09aed879a /Modules/_threadmodule.c | |
parent | 9bb758cee7f1694807ebe600b6230fb8e565d3ea (diff) | |
download | cpython-git-ae58649721ec898ea4a101b0861e16fff3511cfa.tar.gz |
Issue #22043: time.monotonic() is now always available
threading.Lock.acquire(), threading.RLock.acquire() and socket operations now
use a monotonic clock, instead of the system clock, when a timeout is used.
Diffstat (limited to 'Modules/_threadmodule.c')
-rw-r--r-- | Modules/_threadmodule.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c index b68c177f03..8f59e036b9 100644 --- a/Modules/_threadmodule.c +++ b/Modules/_threadmodule.c @@ -57,7 +57,7 @@ acquire_timed(PyThread_type_lock lock, PY_TIMEOUT_T microseconds) if (microseconds > 0) { - _PyTime_gettimeofday(&endtime); + _PyTime_monotonic(&endtime); endtime.tv_sec += microseconds / (1000 * 1000); endtime.tv_usec += microseconds % (1000 * 1000); } @@ -83,7 +83,7 @@ acquire_timed(PyThread_type_lock lock, PY_TIMEOUT_T microseconds) /* If we're using a timeout, recompute the timeout after processing * signals, since those can take time. */ if (microseconds > 0) { - _PyTime_gettimeofday(&curtime); + _PyTime_monotonic(&curtime); microseconds = ((endtime.tv_sec - curtime.tv_sec) * 1000000 + (endtime.tv_usec - curtime.tv_usec)); |