Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

put a pipe in a dictionary

PMU_PIPE_MAP = {}

PIPE= 'tmp/%s.pipe' % hostname
if not os.path.exists(PIPE):
    os.mkfifo(PIPE)

PMU_PIPE_MAP[hostname] = os.open(PIPE, os.O_WRONLY)

Im trying to open n pipes. In order to keep track of them I'd like to store them somehow - like in a dictionary - I thought that the above code should work but it freezes during execution. Any suggestions?

This does work however:

pipein = os.open(PIPE, os.O_WRONLY)
like image 253
channon Avatar asked Mar 22 '26 07:03

channon


1 Answers

Aha! apparently there has to be a read on the other end before we can get a return from the pipe. So the question that I asked was not correct because I failed to test the two scenarios in the same way. So my problem was in understanding how pipes work. In this situation the dictionary entry will succeed once the piping is opened on the 'read' end but will block until then. how to determine if pipe can be written

like image 78
channon Avatar answered Mar 24 '26 20:03

channon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!