diff options
author | Richard Oudkerk <shibturn@gmail.com> | 2013-02-26 12:37:07 +0000 |
---|---|---|
committer | Richard Oudkerk <shibturn@gmail.com> | 2013-02-26 12:37:07 +0000 |
commit | ba48264bce265a70157181dbd499f99a50ec0931 (patch) | |
tree | 32da976b02bf5be9dbc4938b5a0ce998ec8a9ee6 /Lib/multiprocessing/forking.py | |
parent | b1bbc0b3dc870ecb7621fa7499f2347fe4a6a8e7 (diff) | |
download | cpython-git-ba48264bce265a70157181dbd499f99a50ec0931.tar.gz |
Issue #17018: Make Process.join() retry if os.waitpid() fails with EINTR.
Diffstat (limited to 'Lib/multiprocessing/forking.py')
-rw-r--r-- | Lib/multiprocessing/forking.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/Lib/multiprocessing/forking.py b/Lib/multiprocessing/forking.py index 55980ffdca..1597ae8f2e 100644 --- a/Lib/multiprocessing/forking.py +++ b/Lib/multiprocessing/forking.py @@ -35,6 +35,7 @@ import os import sys import signal +import errno from multiprocessing import util, process @@ -129,12 +130,17 @@ if sys.platform != 'win32': def poll(self, flag=os.WNOHANG): if self.returncode is None: - try: - pid, sts = os.waitpid(self.pid, flag) - except os.error: - # Child process not yet created. See #1731717 - # e.errno == errno.ECHILD == 10 - return None + while True: + try: + pid, sts = os.waitpid(self.pid, flag) + except os.error as e: + if e.errno == errno.EINTR: + continue + # Child process not yet created. See #1731717 + # e.errno == errno.ECHILD == 10 + return None + else: + break if pid == self.pid: if os.WIFSIGNALED(sts): self.returncode = -os.WTERMSIG(sts) |