python多重同步fi

2024-09-30 01:20:18 发布

您现在位置:Python中文网/ 问答频道 /正文

如何使用Python3打开多个fifo? 下面的代码非常简单,但它在最后一行堆叠并等待(?)。。。 有什么需要帮忙的吗

   toAgent = ['ABCD', 'EFGH', 'IJKL', 'MNOP',]

   def createPipe():

        for i in range(0, len(toAgent)):
            #print(i)
            fifoName = '../tmp/' + toAgent[i]       
            if not os.path.exists(fifoName):
                os.mkfifo(fifoName) 

                pipeName = 'pipe_' + str(i)
                print(pipeName, fifoName)
                pipeName = os.open(fifoName, os.O_WRONLY )

Tags: 代码forosdefpython3fifoprintabcd

热门问题