[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: (BUG LISP) at MIT-MC
- From: KMP at MIT-MC (Kent M. Pitman)
- Date: Sat, 13 Jan 79 22:14:00 GMT
- Original-date: 13 JAN 1979 1714-EST
Well, here we go again. I have a problem with NOINTERRUPT and UNWIND-PROTECT
and so on. I don't think that UNWIND-PROTECT is powerful enough to handle
the problem I have.
Situation: Interrupts may be on or off (they are set at random by some
Goal: To turn off interrupts for a moment, execute a piece of code and
guarantee that no matter what happens, interrupts will be left as
they had been initially.
Examples of lossages:
 UNWIND-PROTECT seems to be restoring the interrupts to what they were
at the end of the execution of its first arg. If there were a way it
could detect that the user had munged with interrupts and would leave
things alone, then it would be okay. As is here is a case of where
I think is is doing the wrong thing. (Remember the value of
(NOINTERRUPT arg) is the former value of NOINTERRUPT.
(UNWIND-PROTECT (PROGN (NOINTERRUPT T) (PRINT 'FOO)) (NOINTERRUPT NIL))
FOO ; I hope interrupts are NIL here ...
T ; Interrupts seem to have been T!
 Error recovery seems to override everything. I'd have thought there
was at least enough power here (maybe even overkill) to get interrupts
off at the end of this sequence, but doesn't do it!
(UNWIND-PROTECT (+ 'A 'B) (NOINTERRUPT T))
;B NON-NUMERIC VALUE
(NOINTERRUPT T) ;I hope interrupts are T already!
NIL ; But they aren't!
What I would like is a way of saying to push interrupts and have them
reset when I exit. Something like UNWIND-PROTECT for interrupts. This
would probably be easy to write from Midas (though I bet impossible
to write from Lisp (discounting LAP)) and would be much more elegant than
some things I've tried.
where <Form-to-evaluate> could reset interrupts as he liked knowing that
when the PUSH-INTERRUPT frame were popped, the world would be happy again.