summaryrefslogtreecommitdiff
path: root/Modules/_threadmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_threadmodule.c')
-rw-r--r--Modules/_threadmodule.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c
index fa7e6d0e09..543d82d0b9 100644
--- a/Modules/_threadmodule.c
+++ b/Modules/_threadmodule.c
@@ -84,13 +84,12 @@ lock_dealloc(lockobject *self)
static PyLockStatus
acquire_timed(PyThread_type_lock lock, _PyTime_t timeout)
{
- PyLockStatus r;
_PyTime_t endtime = 0;
-
if (timeout > 0) {
- endtime = _PyTime_GetMonotonicClock() + timeout;
+ endtime = _PyDeadline_Init(timeout);
}
+ PyLockStatus r;
do {
_PyTime_t microseconds;
microseconds = _PyTime_AsMicroseconds(timeout, _PyTime_ROUND_CEILING);
@@ -114,7 +113,7 @@ acquire_timed(PyThread_type_lock lock, _PyTime_t timeout)
/* If we're using a timeout, recompute the timeout after processing
* signals, since those can take time. */
if (timeout > 0) {
- timeout = endtime - _PyTime_GetMonotonicClock();
+ timeout = _PyDeadline_Get(endtime);
/* Check for negative values, since those mean block forever.
*/