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的推送

posted @ 2015-07-01 08:34  何似王  阅读(1533)  评论(0编辑  收藏  举报