出现的问题是
Pipe.send()
here
.
#!/usr/bin/env python
from multiprocessing import Pipe, Process
import time
import sys
def foo(conn):
d = {'word'+str(elem): elem for elem in range(5000)} # changed to 5000
conn.send(d)
conn.close()
recv_end, send_end = Pipe(duplex=False)
p = Process(target=foo, args=(send_end, ))
p.start()
start_time = time.time()
recv_end.recv() # Try to comment and you will see that it waits for being received
p.join()
print('--- %s seconds ---' % (time.time()-start_time))