Re: signals and atomicity
erikyyy@studbox.uni-stuttgart.de writes:
> now perhaps it is not interesting, wether the wait call succeeded, because
> you can start it again. but what about a call to "read()" ? i MUST know,
> wether it worked or wether it was interrupted by a signal!
Off the top of my head, if you issue a blocking read, and it gets
interrupted, it will either return -1 and errno will be == EINTR or it
will return the data already read. Hence you should always check to
see if you got what you expected. If it's a non-blocking read, then
the same applies, but you should definitely be equipped to handle
partial reads (see the man page "man 2 read" for more info, or the
libc info pages).
Note that you can set things up so that interrupted system calls
restart themselves rather than returning with an error, but I don't
recall at the moment which function does that.
--
Rob Browning <rlb@cs.utexas.edu>
PGP fingerprint = E8 0E 0D 04 F5 21 A0 94 53 2B 97 F5 D6 4E 39 30
--
To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Reply to: