Talk:IPC via named pipe: Difference between revisions

tricky indeed
(Ooooh! That was hard!)
 
(tricky indeed)
Line 1:
This is tricky! The “<tt>in</tt>” reader side is normal asynchronous IO (the pipe becomes readable when there's data available) but the “<tt>out</tt>” writer side is very awkward because you ''can't'' open the writer side of a FIFO if there is no reader there. You've either got to use a blocking open() — which might or might not work with a threaded solution — or deal with the failure to open() it in non-blocking mode by polling regularly. Tricky stuff! –[[User:Dkf|Donal Fellows]] 09:38, 30 September 2011 (UTC)
 
: Actually I don't think <code>O_WRONLY|O_NONBLOCK</code> on a fifo will ever succeed on a POSIX system. On Linux, you can <code>O_RDWR</code> open a fifo, and it will not block (because the program itself is the reader then), but then you can't <code>select</code> it for write readiness because it ''always'' returns immediately with success. Luckily here one thread blocking on open will not hold up the entire process, so it's relatively easy to deal with. --[[User:Ledrug|Ledrug]] 11:44, 30 September 2011 (UTC)
Anonymous user