mirror of
https://github.com/python/cpython.git
synced 2025-12-11 11:31:05 +00:00
PEP 475: on EINTR, retry the function even if the timeout is equals to zero
Retry: * signal.sigtimedwait() * threading.Lock.acquire() * threading.RLock.acquire() * time.sleep()
This commit is contained in:
parent
f70e1ca0fc
commit
6aa446cf03
3 changed files with 3 additions and 3 deletions
|
|
@ -84,7 +84,7 @@ acquire_timed(PyThread_type_lock lock, _PyTime_t timeout)
|
||||||
|
|
||||||
/* Check for negative values, since those mean block forever.
|
/* Check for negative values, since those mean block forever.
|
||||||
*/
|
*/
|
||||||
if (timeout <= 0) {
|
if (timeout < 0) {
|
||||||
r = PY_LOCK_FAILURE;
|
r = PY_LOCK_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1011,7 +1011,7 @@ signal_sigtimedwait(PyObject *self, PyObject *args)
|
||||||
|
|
||||||
monotonic = _PyTime_GetMonotonicClock();
|
monotonic = _PyTime_GetMonotonicClock();
|
||||||
timeout = deadline - monotonic;
|
timeout = deadline - monotonic;
|
||||||
if (timeout <= 0)
|
if (timeout < 0)
|
||||||
break;
|
break;
|
||||||
} while (1);
|
} while (1);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1455,7 +1455,7 @@ pysleep(_PyTime_t secs)
|
||||||
|
|
||||||
monotonic = _PyTime_GetMonotonicClock();
|
monotonic = _PyTime_GetMonotonicClock();
|
||||||
secs = deadline - monotonic;
|
secs = deadline - monotonic;
|
||||||
if (secs <= 00)
|
if (secs < 0)
|
||||||
break;
|
break;
|
||||||
/* retry with the recomputed delay */
|
/* retry with the recomputed delay */
|
||||||
} while (1);
|
} while (1);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue