asynchronous timed I/O. How?

Don Libes libes at nbs-amrf.UUCP
Sun Oct 20 13:06:22 AEST 1985


I am familiar with asynchronous i/o via fcntl() & SIGIO and timed i/o
via timers & alarms.  Is it possible to get both at the same time (on 4.
2)?  I have a need for something like:  

/* fd is non-blocking */
timed_read(fd,buffer,length,timeout)

The only possibility (short of interrupting on every char - is that
really feasible?) I've considered is setting a timer and when it goes
off, checking via FIONCTL when the i/o would complete or not.  But
this means that all my reads will always take the max time allowed.

Any suggestions?

Also (if you've gotten this far), I need to catch an interrupt when
timeout occurs OR the read completes (and set a status).  So my final
version would look like:

timed_read(fd,buffer,length,timeout,&status,function)

Don Libes {seismo,umcp-cs}!nbs-amrf!libes



More information about the Comp.unix.wizards mailing list