Why does a named pipe (FIFO) give me my data twice ???

2001-02-26 Thread Marc W
hello! I've got a program that creates a named pipe, and then spawns a thread which sits in a loop: // error checking snipped. // while (1) { int fifo = open(fifoPath, O_RDONLY); // this blocks fprintf(stderr, "somebody opened the other end!\n");

Re: Why does a named pipe (FIFO) give me my data twice ???

2001-02-26 Thread Dima Dorfman
If the first program calls open(2) before the second one calls close(2) the former will not block because there's already a writer on the pipe. A possible workaround would be to unlink and recreate the fifo in program one, like so: for (;;) { int fifo;