Async File Read ?

Async File Read ?

Post by TABo » Thu, 01 Dec 1994 06:25:06



Hello,
   Any guidance to where to find info on performing an async file read.
The goal is to perform the start of  the read , do something else , and
when the read completes process the completed read.  The completion
notification could be getting a interrupt or a signal when the completion
has occured.  Any ideas of how to do this or where to find info for doing
this async read?  Thanks for your help in advance.

                                           Tom

 
 
 

Async File Read ?

Post by Jeff Dicks » Thu, 01 Dec 1994 09:32:42



>Hello,
>   Any guidance to where to find info on performing an async file read.
>The goal is to perform the start of  the read , do something else , and
>when the read completes process the completed read.  The completion
>notification could be getting a interrupt or a signal when the completion
>has occured.  Any ideas of how to do this or where to find info for doing
>this async read?  Thanks for your help in advance.

>                                           Tom

The time that elapses between the start and the end of the read operation
is miniscule if the requested number of bytes is readily present. If you're
worried about being held up for data to arrive (blocking), then you could set
the file for asynchronous IO and get notified (via the signal SIGIO) whenever
data was available. Plus you could use the FIONREAD ioctl to determine just
how much had arrived and thus avoid being blocked for some arbitrary amount.
This would be much easier to implement than the manner you described. The
chore of reading and/or making sense out of the data could be delegated to a
handler that would get invoked (asynchronously) whenever the SIGIO signal was
set.

Jeff S.*son