[squeak-dev] Re: Catching user interrupts

Andreas Raab andreas.raab at gmx.de
Fri May 21 02:55:18 UTC 2010


Hi Ralph -

The answer to your question depends a little on why you're trying to do 
what you're doing. Generally speaking, there's a #userInterruptWatcher 
process that waits until the interrupt semaphore is signaled and then 
does whatever it is instructed to do. It could easily interrupt the UI 
process with an exception for example, in which case your code (if run 
from the UI process) would work.

On the other hand, if what you're really trying to do is to seal an 
image for production purposes you can just kill the interrupt watcher 
process and no interrupt handler will ever be run. Or, you can do what 
we do in our production images - use the interrupt watcher to signal the 
UI to pop up a password box which will allow you to break into the 
running app if you enter the correct password.

So there's a bunch of options depending on what you're trying to do.

Cheers,
   - Andreas

On 5/20/2010 3:10 PM, Ralph Boland wrote:
> I would like to be able to catch a user interrupt or, if not possible,
> some other user action like a key stroke or mouse action much like
> one catches an Error.  Ideally my code would look something like:
>
> [some code]  on:  Interrupt  do:  [process Interrupt].
>
> Of course there is no class Interrupt and even if there was
> my guess is that user interrupts are handled at a low enough
> level that the above code wouldn't work anyway.
> For example, for the code:
>
>    [some code]  on:  Error  do:  [process Interrupt].
>
> The user interrupt is generated while  "some code" is running
> so the  "process Interrupt" code has no chance of running.
>
> A simple question.  I'm guessing the answer is not so simple
> and perhaps not so safe.
>
> I hope others find this question interesting.
>
> Regards,
>
> Ralph Boland
>
>




More information about the Squeak-dev mailing list