summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing
diff options
context:
space:
mode:
authorRichard Oudkerk <shibturn@gmail.com>2012-07-27 13:06:11 (GMT)
committerRichard Oudkerk <shibturn@gmail.com>2012-07-27 13:06:11 (GMT)
commit4887b1c0e7a5a27a97ef2ecdae369b7d3a021f01 (patch)
tree794aee9c1bd7362f8c57a8ab2c1be9ace381bf91 /Lib/multiprocessing
parenta58d668fd92bab2265979784ef8edb9c3ea3f093 (diff)
downloadcpython-4887b1c0e7a5a27a97ef2ecdae369b7d3a021f01.zip
cpython-4887b1c0e7a5a27a97ef2ecdae369b7d3a021f01.tar.gz
cpython-4887b1c0e7a5a27a97ef2ecdae369b7d3a021f01.tar.bz2
Issue #6056: Make multiprocessing use setblocking(True) on the sockets it uses.
Original patch by J Derek Wilson.
Diffstat (limited to 'Lib/multiprocessing')
-rw-r--r--Lib/multiprocessing/connection.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/multiprocessing/connection.py b/Lib/multiprocessing/connection.py
index f537a36..4fa6f70 100644
--- a/Lib/multiprocessing/connection.py
+++ b/Lib/multiprocessing/connection.py
@@ -199,6 +199,8 @@ if sys.platform != 'win32':
'''
if duplex:
s1, s2 = socket.socketpair()
+ s1.setblocking(True)
+ s2.setblocking(True)
c1 = _multiprocessing.Connection(os.dup(s1.fileno()))
c2 = _multiprocessing.Connection(os.dup(s2.fileno()))
s1.close()
@@ -264,6 +266,7 @@ class SocketListener(object):
self._socket = socket.socket(getattr(socket, family))
try:
self._socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
+ self._socket.setblocking(True)
self._socket.bind(address)
self._socket.listen(backlog)
self._address = self._socket.getsockname()
@@ -282,6 +285,7 @@ class SocketListener(object):
def accept(self):
s, self._last_accepted = self._socket.accept()
+ s.setblocking(True)
fd = duplicate(s.fileno())
conn = _multiprocessing.Connection(fd)
s.close()
@@ -299,6 +303,7 @@ def SocketClient(address):
'''
family = address_type(address)
with socket.socket( getattr(socket, family) ) as s:
+ s.setblocking(True)
t = _init_timeout()
while 1: