Date: Wed, 13 Mar 1996 08:32:48 +1030 (CST) From: Michael Smith <msmith@atrad.adelaide.edu.au> To: luigi@labinfo.iet.unipi.it (Luigi Rizzo) Cc: leisner@sdsp.mc.xerox.com, msmith@atrad.adelaide.edu.au, questions@freebsd.org Subject: Re: non-blocking read ? Message-ID: <199603122202.IAA29184@genesis.atrad.adelaide.edu.au> In-Reply-To: <199603121733.SAA20865@labinfo.iet.unipi.it> from "Luigi Rizzo" at Mar 12, 96 06:33:14 pm
next in thread | previous in thread | raw e-mail | index | archive | help
Luigi Rizzo stands accused of saying: > > > > Luigi Rizzo stands accused of saying: > > > > is there a simple way to issue a non-blocking read to a regular file ? > > > > > > > > Ideally, I would like a > > > > > > > > nbread(handle, buf, count); > > > > > > > > which would start reading from the disk, and could then notify > > > > the completion of I/O via select(). > > > > > > Use async I/O and handle SIGIO like everybody else 8) > > > > Reads to regular files are non-blocking by default -- you either read > > the next block or return EOF...note, they may take "time", but it isn't > > That's my problem... some programs (noticeably the "harvest" cache) > work as a single-threaded process which serves concurrent > requests by trying to avoid blocking calls. It appears to do a nice > job, but for some things (say reads/seeks etc. from disk) it appears > that there is no way to avoid delays -- at least to my knowledge. Grr, read my original response. I wasn't being stupid. Look at fcntl, in particular O_ASYNC, and signal in regards to SIGIO. (This is how Harvest works). You'll need to do a bit more work internally to track your I/O, but it may be worth the effort. > Luigi -- ]] Mike Smith, Software Engineer msmith@atrad.adelaide.edu.au [[ ]] Genesis Software genesis@atrad.adelaide.edu.au [[ ]] High-speed data acquisition and (GSM mobile) 0411-222-496 [[ ]] realtime instrument control (ph/fax) +61-8-267-3039 [[ ]] Collector of old Unix hardware. "Where are your PEZ?" The Tick [[
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199603122202.IAA29184>