logo       

RE: stdin set to nonblocking mode: msg#00070

lang.haskell.glasgow.bugs

Subject: RE: stdin set to nonblocking mode

On 11 August 2005 01:18, John Meacham wrote:

> Why do we set file descriptors to nonblocking mode anyway if they are
> waited on by a select. there shouldn't be a need to use both

It avoids an extra system call per read(), i.e. a single read() instead
of select() + read(). And there's a slight chance of a race between the
select() and read() calls, if some other thread or process is reading
from the same descriptor. With non-blocking read(), this isn't an
issue.

The overhead of the extra syscall is probably a non-issue, but the race
is mildly worrying.

Cheers,
Simon


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise