1
I’m trying a simple communication between processes, but the son f_filho
is not receiving the message sent by the father.
How to solve?
# -*- coding: cp1252 -*-
from multiprocessing import Process,Pipe
import numpy as np
def f_filho(pipe):
frase=pipe.recv()
print frase
if __name__ == '__main__':
pipe_pai,pipe_filho=Pipe()
print('começando o programa')
p=Process(target=f_filho , args=(pipe_filho,))
p.start()
pipe_pai.send(['ola meu filho']) #inica comunicação pelo pipe para o filho
pipe_pai.close()
p.join()
print('fiiim')
Shouldn’t it be a loop reading? I can’t guarantee that the anonymous pipe will be blocking in the function
recv
, then it costs nothing to read in a bow– Jefferson Quesado