[Python-checkins] cpython: PEP 475: on EINTR, retry the function even if the timeout is equals to zero

victor.stinner python-checkins at python.org
Mon Mar 30 21:34:21 CEST 2015


https://hg.python.org/cpython/rev/85fea45ca94d
changeset: 95303:85fea45ca94d
user: Victor Stinner <victor.stinner at gmail.com>
date: Mon Mar 30 21:33:51 2015 +0200
summary:
 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()
files:
 Modules/_threadmodule.c | 2 +-
 Modules/signalmodule.c | 2 +-
 Modules/timemodule.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c
--- a/Modules/_threadmodule.c
+++ b/Modules/_threadmodule.c
@@ -84,7 +84,7 @@
 
 /* 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
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -1011,7 +1011,7 @@
 
 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
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -1455,7 +1455,7 @@
 
 monotonic = _PyTime_GetMonotonicClock();
 secs = deadline - monotonic;
- if (secs <= 00)
+ if (secs < 0)
 break;
 /* retry with the recomputed delay */
 } while (1);
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /