From: Victor Stinner Date: Mon, 30 Mar 2015 19:33:51 +0000 (+0200) Subject: PEP 475: on EINTR, retry the function even if the timeout is equals to zero X-Git-Tag: v3.5.0a4~253 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6aa446cf039f9533a5ecf2400bf060db4313a417;p=thirdparty%2FPython%2Fcpython.git 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() --- diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c index 0907aa0eb25f..323447f9daa3 100644 --- a/Modules/_threadmodule.c +++ b/Modules/_threadmodule.c @@ -84,7 +84,7 @@ acquire_timed(PyThread_type_lock lock, _PyTime_t timeout) /* Check for negative values, since those mean block forever. */ - if (timeout <= 0) { + if (timeout < 0) { r = PY_LOCK_FAILURE; } } diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c index 3081562abced..a1fda3eb315a 100644 --- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@ -1011,7 +1011,7 @@ signal_sigtimedwait(PyObject *self, PyObject *args) monotonic = _PyTime_GetMonotonicClock(); timeout = deadline - monotonic; - if (timeout <= 0) + if (timeout < 0) break; } while (1); diff --git a/Modules/timemodule.c b/Modules/timemodule.c index 74c544a62dd8..5f6290d98ff3 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -1455,7 +1455,7 @@ pysleep(_PyTime_t secs) monotonic = _PyTime_GetMonotonicClock(); secs = deadline - monotonic; - if (secs <= 00) + if (secs < 0) break; /* retry with the recomputed delay */ } while (1);