http://www.perlmonks.org?node_id=478131


in reply to select($rin,undef,undef,undef) only blocking once

The select function makes use of the C select(2) system call.

As the docs for select(2) state, file descriptors "will be watched to see if characters become available for reading (more precisely, to see if a read will not block ... a file descriptor is also ready on end-of-file)"

Once you've read data from the pipe once, the file pointer will be pointing at EOF, and hence the select call will always return ready.

In a situation like this, I would consider using a blocking read over blocking on file readiness; alternatively, look into the use of seek or sysseek to try to clear the file's EOF condition (which may not be possible - I can't test it here).

Hope that helps.

-- Foxcub
#include www.liquidfusion.org.uk

Update: rabbit7 indicates that sysseek doesn't work with a fifo. Updated to reflect this.