how do you time-out on a read?

lwa at mit-csr lwa at mit-csr
Sun Jul 24 01:09:00 AEST 1983


I use this scheme also, but there are a couple of potential problems
that people should be aware of:
          1) If you're using the Berkeley job-control stuff, the signal
             won't interrupt the read.  This is a "feature" of the sigsys()
             system call.  Note that any time you link against
             /usr/lib/libjobs.a, you get a version of the signal() routine
             which actually does a sigsys system call and hence gets you
             this feature whether you want it or not.  (See the documentation
             in Jobs(III) in the 4.1 UPM).
          2) There's a race condition between the alarm and the read call.
             If the alarm goes off between the time you set it and the
             time you do the read, you may sleep forever.  In practice, this
             is only a problem with very short alarms (one or two seconds),
             but the problem does exist.
                                                  -Larry Allen
-------



More information about the Comp.unix.wizards mailing list