]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
PEP 475: on EINTR, retry the function even if the timeout is equals to zero
authorVictor Stinner <victor.stinner@gmail.com>
Mon, 30 Mar 2015 19:33:51 +0000 (21:33 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Mon, 30 Mar 2015 19:33:51 +0000 (21:33 +0200)
Retry:

* signal.sigtimedwait()
* threading.Lock.acquire()
* threading.RLock.acquire()
* time.sleep()

Modules/_threadmodule.c
Modules/signalmodule.c
Modules/timemodule.c

index 0907aa0eb25f9c1c438bdb31e45ed66e30c6004a..323447f9daa384b3bf7f20f90919c8aba660225d 100644 (file)
@@ -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;
                 }
             }
index 3081562abced6093de9afb2fe50af2a78a62a2d6..a1fda3eb315a24c2f68a3898fac5c3d6827c00b2 100644 (file)
@@ -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);
 
index 74c544a62dd8242d6b87a2bfcb65f0ad95f31c1f..5f6290d98ff3160f1bab6ddb3f62a0c7d4b67711 100644 (file)
@@ -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);