asynchronous I/O

William LeFebvre phil at rice.ARPA
Tue Dec 4 15:10:06 AEST 1984


Mark Sienkiewicz...

> Another problem is that if the parent is also doing synchronous I/O,
> strange things may happen.  The problem I noticed most often was that
> if you are blocked for a read, then another process sends you a signal,
> your process jumps off to the signal handler, but the read returns -1.

That's supposed to happen.  The global variable errno will also be set
to EINTR, which indicates:

          An asynchronous signal (such as interrupt or quit),
          which the user has elected to catch, occurred during a
          system call.  If execution is resumed after processing
          the signal, it will appear as if the interrupted system
          call returned this error condition.

(This is under BSD, but I'm pretty sure that things are very similar
under Bell Unix).

If you expect your reads to be interrupted by signals, you should be
prepared to handle the condition and take appropriate action (such as
calling read again).

                                William LeFebvre
				Department of Computer Science
				Rice University
                                <phil at Rice.arpa>



More information about the Comp.unix.wizards mailing list