Interrupts (was Re: [Rd] X11 protocol errors ...)
Thu, 23 Aug 2001 08:16:09 -0400
On Wed, 22 Aug 2001 19:32:51 -0500, you wrote:
>I'm surprised we don't get more of these sorts of things on UNIX. Our
>current UNIX interrupt handling approach takes an immediate LONGJMP
>out of the signal handler no matter where the signal occurs (except
>for two places where signals are suspended). Any place where an
>invariant is temporarily broken, any place where an assignment is not
>yet complete, is a potential trouble spot.
Delphi protects against these kind of errors with "try ... except ..."
and "try ... finally ..." blocks to deal with exceptions. The first
one executes special code if an exception occurs, the second
guarantees execution of cleanup code.
These are implemented as a linked list of records on the stack which
the exception handler knows how to interpret. When a particular kind
of exception occurs, all "finally" blocks are executed in the
appropriate order (and the stack base pointer is moved to simulate
exits from all active routines) until an "except" block handling the
particular kind of exception is reached.
C doesn't have these statements built in, but presumably someone has
written macros to do the same sort of thing. Adding them would be a
lot of work, but would be worthwhile.
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: email@example.com