mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Issue #17097: Make multiprocessing ignore EINTR.
This commit is contained in:
parent
8087879349
commit
cca8c53d6a
3 changed files with 86 additions and 4 deletions
|
@ -366,7 +366,10 @@ class Connection(_ConnectionBase):
|
|||
def _send(self, buf, write=_write):
|
||||
remaining = len(buf)
|
||||
while True:
|
||||
n = write(self._handle, buf)
|
||||
try:
|
||||
n = write(self._handle, buf)
|
||||
except InterruptedError:
|
||||
continue
|
||||
remaining -= n
|
||||
if remaining == 0:
|
||||
break
|
||||
|
@ -377,7 +380,10 @@ class Connection(_ConnectionBase):
|
|||
handle = self._handle
|
||||
remaining = size
|
||||
while remaining > 0:
|
||||
chunk = read(handle, remaining)
|
||||
try:
|
||||
chunk = read(handle, remaining)
|
||||
except InterruptedError:
|
||||
continue
|
||||
n = len(chunk)
|
||||
if n == 0:
|
||||
if remaining == size:
|
||||
|
@ -581,7 +587,13 @@ class SocketListener(object):
|
|||
self._unlink = None
|
||||
|
||||
def accept(self):
|
||||
s, self._last_accepted = self._socket.accept()
|
||||
while True:
|
||||
try:
|
||||
s, self._last_accepted = self._socket.accept()
|
||||
except InterruptedError:
|
||||
pass
|
||||
else:
|
||||
break
|
||||
s.setblocking(True)
|
||||
return Connection(s.detach())
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue