Re: Problem with socketpair , AF_UNIX and select call - can anybody through any light on this!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 12 Oct 2007 12:02:41 +0100
Andy Green <andy@xxxxxxxxxxx> wrote:

> Somebody in the thread at some point said:
> > Andy Green wrote,
> >> Why don't you try removing the O_NONBLOCK since you test with
> >> select...
> > 
> > Never, ever, do that ... select only returns a hint that an IO operation 
> > might succeed, not a guarantee (google for "spurious wakeup"), hence a 
> > subsequent read/write might block if the descriptor isn't set to 
> > O_NONBLOCK, and that's almost always not what's wanted or expected.
> 
> Wah, man select says it too
> 
>        Under  Linux,  select()  may  report  a  socket file descriptor
> as "ready for reading", while nevertheless a subsequent read
>        blocks. This could for example happen when data has arrived but
> upon examination has wrong checksum and is discarded.  There
>        may  be  other circumstances in which a file descriptor is
> spuriously reported as ready.  Thus it may be safer to use O_NON-
>        BLOCK on sockets that should not block.
> 
> Pretty freakish, thanks for the tip.

Its the documented behaviour of select. select tells you "at the moment
in time I checked the next whatever operation would not block". It makes
no further guarantees, thus select should almost always be used with non
blocking I/O.

Alan

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux