|
From: Ype K. <yk...@xs...> - 2002-01-26 16:20:30
|
Jeff, >Hello, > Is there a way to stop the interpeter while >it is executing a script? The situation I have is >that the script my be monitering something in a polling >loop, and the user wants to cancel it. I provide a >scriptIsTerminating method on an object I make visible, >but if they choose to ignore that, or are hung, I need a way >for force a termination of the script. You can use a deprecated method in java.lang.Thread to stop the user thread. There is some example code in demo/swing/console.py iirc. In Sun's documentation of java.lang.Thread you'll also find that the preferred way of doing this is to send the thread an interrupt, but the thread should check for being interrupted. An alternative is java.lang.System.exit(), but that might be too drastic... Good luck, Ype -- |