bug-hurd
[Top][All Lists]
Advanced

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

Re: io_select support for netfs


From: Bas Wijnen
Subject: Re: io_select support for netfs
Date: Thu, 29 Jul 2004 13:59:25 +0200
User-agent: Mutt/1.3.28i

On Wed, Jul 28, 2004 at 01:53:47PM -0700, Thomas Bushnell, BSG wrote:
> 
> Be very careful in general with select on network thingies.  This
> doesn't apply to your use, but I want it on the record.  To return
> select true means that you can immediately do I/O with no waiting.
> 
> That means that you certainly already have the data to read here on
> the local computer, you cannot reliably expect to read something over
> a network, ever.

Even without network you should be careful.  If you have a multithreaded
program, or a source which is read by multiple processes, or some other reason
the state can have changed without the selecting thread doing anything, you
may not be able to read any data after a successful select.  If you want to
prevent blocking, you should use O_NONBLOCK, even if you use select.

As a side note, I heard there is a "bug" in Linux, which blocks on writing to
a (named) pipe if the data is larger than the buffer (and does not make it a
short write, as everybody would expect), if you don't use O_NONBLOCK.  So that
may block after select returned true, even if nothing changed.  Officially
this is not a bug, there is no standard which says it shouldn't be doing this.

Thanks,
Bas

-- 
I encourage sending me encrypted e-mail.
Please send the central message of e-mails as plain text in the message body,
   not as HTML and definitely not as MS Word.
Please do not use the MS Word format for attachments either.
for more information, see http://129.125.47.90/e-mail.html

Attachment: pgpJw7VgymPIy.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]