Why my process cannot terminate when Pipe Connection is closed
kw429 at cornell.edu
Wed Jun 22 18:49:56 EDT 2016
import multiprocessing as mp
"""send obj to pipe"""
for i in range(10):
def transform(func, conn):
"""receive input from pipe, transform it"""
i = conn.recv()
c_1, c_2 = mp.Pipe()
p1 = mp.Process(target=send, args=(c_1,))
p2 = mp.Process(target=transform, args=(lambda x: x ** 2, c_2,))
In python documentation it's stated, recv() Blocks until there its something to receive. Raises EOFError if there is nothing left to receive and the other end was closed.
But why this code doesn't terminate?
More information about the Python-list