Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我用这个创建了一个先进先出:mkfifo("myfifo", 0666); 现在,我想用它打开它,inf fd = open("./myfifo",O_WRONLY);但这会让我进入一个无限循环,为什么?
mkfifo("myfifo", 0666);
inf fd = open("./myfifo",O_WRONLY);
从fifo(7)手册页:
fifo(7)
FIFO 必须在两端(读取和写入)都打开,才能传递数据。通常,打开 FIFO 会阻塞,直到另一端也打开。
你所拥有的不是无限循环。您的进程只是被阻止等待打开管道另一端的东西。