View Single Post
  #6  
Old 02-27-2008, 07:29 AM
unix unix is offline
Junior Member
 
Join Date: Sep 2009
Posts: 0
Default Re: use of select() on FIFO after it has closed

"David Mathog" wrote in message
news:fq1gl6$11o$1@naig.caltech.edu...
> Barry Margolin wrote:
>>
>> Does the O_NONBLOCK option to open(2) help?

>
> (Sheepishly) Yes, that did it.


Ignoring O_RDWR (undefined by POSIX for a FIFO), open(fifo, O_RDONLY |
O_NONBLOCK) then open(fifo, O_WRONLY) is the only way because open(fifo,
O_WRONLY) blocks until the FIFO is open for reading and open(fifo, O_WRONLY
| O_NONBLOCK) returns an error (ENXIO) if the FIFO is not open for reading.

Alex


Reply With Quote