[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Signal doesn't interrupt read() and wait() - help!



Mario Becroft <mb@tos.pl.net> writes:

|> Someone else said that using longjmp from the signal handler was one
|> solution, but I still don't see how this would enable me to interrupt the
|> system call. What am I missing here?

You do a setjmp before read(), and if setjmp returns with non-zero (from
within the signal handler) you jump around the read() call, or do whatever
you would if read returned EINTR.  I'm not sure, but i think rcs uses this
kind of workaround.  Of course, this is slower than a real kernel support.

-- 
Andreas Schwab                                      "And now for something
schwab@issan.informatik.uni-dortmund.de              completely different"
schwab@gnu.org