<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Thu, Aug 30, 2018 at 9:08 AM Brian Wood <<a href="mailto:woodbrian77@gmail.com">woodbrian77@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>The docs for select() says:<br></div><div dir="ltr"><br></div><div dir="ltr"> Under Linux, select() may report a socket file descriptor as <br></div><div dir="ltr">"ready for reading", while nevertheless a subsequent  read <br></div><div dir="ltr">blocks.  This could for example happen when data has arrived <br></div><div dir="ltr">but upon examination has wrong checksum and is discarded.  <br></div><div dir="ltr">There may be other circumstances in which a file descriptor is  <br></div><div dir="ltr">spuriously reported as ready.  Thus it may be safer to use <br></div><div dir="ltr">O_NONBLOCK on sockets that should not block.<br></div><div dir="ltr"><br></div><div>I was thinking that poll() is also similarly afflicted on Linux, but</div><div>the docs for poll() don't mention anything similar.  Does anyone</div><div>know if poll() used to have the problem, but no longer does</div><div>or if it does, but the docs fail to mention it?</div></div></div></blockquote><div><br></div><div><br></div><div>I was looking at docs in the "3P" section on poll() -- I guess  the 'P'</div><div> may stand for Posix.  When I checked poll() in section 2, there's a <br></div><div>note referring you to select() spurious bugs.  So I believe this is <br></div><div>still a problem for poll().</div><div><br></div><div>I have another program where I'm still using poll() so I guess I'll</div><div>have to take some defensive measures related to this.</div><div><br></div><div>Brian</div><div>Ebenezer Enterprises</div><div><a href="http://webEbenezer.net">http://webEbenezer.net</a><br></div></div></div>