python 中的pipe

 1 from multiprocessing import Process,Queue,Pipe
 2 import os
 3 def f(q):
 4 #    q.send([42,None,'hello'])
 5     print('This is child_conn ....' % q.recv())
 6 #    q.close()
 7     print 'Os getpid is %s...' % os.getpid()
 8 
 9 if __name__=='__main__':
10     parent_conn,child_conn=Pipe()
11     parent_conn.send(['good',None,100])
12     p=Process(target=f,args=(child_conn,))
13     p.start()
14     print(parent_conn.recv())
15     parent_conn.close()
16     p.join()

?f(q)內的做爲child_conn的q爲何接收不到parent_conn的推送spa

相關文章
相關標籤/搜索