Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Jan 2000 10:24:34 -0800
From:      "Scott Hess" <scott@avantgo.com>
To:        "Zhihui Zhang" <zzhang@cs.binghamton.edu>, <freebsd-questions@freebsd.org>
Subject:   Re: Questions about select() and O_NONBLOCK
Message-ID:  <04a501bf593c$72930210$1e80000a@avantgo.com>
References:  <Pine.GSO.3.96.1000107113601.720A-100000@sol.cs.binghamton.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
Zhihui Zhang <zzhang@cs.binghamton.edu> wrote:
> I hope that someone will clarify the following questions for me:
>
> (1) Can select() be used with regular files, like myfile.txt?
>
> (2) Does O_NONBLOCK or O_NDELAY work on regular files?
>
> Any help is appreciated.

At this time, regular files are _always_ ready for I/O, and _always_
fulfill your complete request (barring other problems, such as end-of-file
our out-of-space conditions).  This is actually the case for all Unix
implementations I'm aware of, though there are sometimes ways to work
around the problem (async I/O, for instance).

[I've been spending the past week working around this problem in the
pthreads library - since file I/O blocks below the pthreads library, disk
I/O is effectively serialized when using pthreads.  I'm working on
integrating rfork() threads to handle disk I/O instead, so that multiple
requests can be pending at a given time.]

Later,
scott




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?04a501bf593c$72930210$1e80000a>