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

handling a keyboard interrupt



    Date: Fri, 20 Apr 90 11:03:50 PDT
    From: kosma%flow@STC.LOCKHEED.COM (Monty Kosma)

    Hi guys,

    I need to be able to trap a keyboard interrupt on the symbolics.  What I'd
    like to do is be able to install an alternate function as a handler for
    when the user does an abort or ctrl-abort.  The purpose behind all this is
    that I have a code which may run for days, and I've installed checkpointing
    code which will restart where it left off if it is halted, but rather than
    throwing the user into the debugger I'd like to use abort/ctrl-abort to
    signal the code to finish its current pass through the inner loop and exit
    with a friendly message rather than the debugger.

    Probably I'd like to handle an abort within the abort handler as an
    immediate exit rather than finishing the inner loop, but this should be
    trivial once I figure out how to trap these interrupts.

Control-Abort just signals the SYS:ABORT condition.  You can use
CONDITION-BIND to catch this condition and do what you want.

Abort, Meta-Abort, and Control-Meta-Abort seem to just do a THROW to the
appropriate top-level, and I'm not sure how to intercept them in the
appropriate dynamic environment.  You can use UNWIND-PROTECT-CASE, but
this would run in the outer environment, so it wouldn't be able to
continue in the function that was interrupted.

Alternatively, instead of overloading the Abort key with this, you could
use a different key (c-C, for instance).  See the documentation in book
7A on "Asynchronous Characters".
.
                                                barmar