[tcljava-user] Re: RE: [Tcl Java] Re: Interrupting a Interp.eval()
Brought to you by:
mdejong
From: W. J. G. <gu...@ea...> - 2001-02-25 22:35:33
|
Sorry for the late reply - it's been a long time (and a couple of projects ;) since I played with Tcl/Tcl Blend. We had the same issue with "runaway TCL interps." I solved it by adding a flag to the interp structure, which the Tcl byte code engine checks after each individual bytecode execution. If the flag is non-zero, the bytecode engine does an "abnormalReturn" which causes it to abort (cleanly!) I then added a new method that can be called on the interp - abortExecution(). it seems to work quite well. john > -----Original Message----- > From: Mo DeJong [mailto:md...@cy...] > Sent: Thursday, July 27, 2000 6:18 PM > To: Marc Saegesser > Cc: tc...@sc... > Subject: [Tcl Java] Re: Interrupting a Interp.eval() > > > On Thu, 27 Jul 2000, Marc Saegesser wrote: > > > I'm embedding several Tcl interpreters inside a JVM. I'm > currently using > > Jacl, but will probably switch to TclBlend at some point in the future. > > > > I'm trying to work out the best approach for cleanly shutting down these > > embedded interpreters. If everything is running normally, I can post a > > TclEvent object whose processEvent() method calls Interp.dispose() and > > causes the event loop to terminate. > > > > The problem with this is that I don't see a way to stop an > interpreter that > > has run amok. Suppose that Interp.eval() is processing a script that is > > stuck in an infinite loop. The notifier's event loop isn't > processing new > > events to my shutdown TclEvent will never get processed. Is > there a good > > method for aborting a call to Interp.eval()? > > There is no way to do this in Jacl. The "how do I stop a runaway thread" > problem is a very tricky one. The best you can really do is put and event > into the queue and code your app so it notices the "quit now" event. |