Thanks for the very clear explanation, Ian.

I figured there was something like that. It turns out I was using a fifo
badly (I was trying to model a sysfs attribute - clearly incorrectly as
I now find out that poll should wait on POLLPRI for sysfs attributes).
The original problem is now solved.

On Thu, 2016-09-15 at 20:07 -0700, Ian Lance Taylor wrote:
> Opening a FIFO for reading blocks until some process opens the FIFO
> for writing.  So your program is not testing what you think it is
> testing.  In the case where you don't open the FIFO for writing, the
> program simply blocks as os.Open before it ever calls poll.  In the
> case where you do write to the FIFO, the program blocks in Open until
> the write, then records the time, runs poll which finds something to
> read, and then prints the time it took to call poll.
> 
> One way to fix this is to use
>     os.OpenFile(*path, os.O_RDONLY|syscall.O_NONBLOCK, 0)
> 
> Ian


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to