Re: May I interrupt an Interpreter?

"Scott G. Miller" <[email protected]> Wed, 29 Nov 2006 16:09:41 -0600
Newsgroups gmane.comp.java.sisc.user
Message-ID <[email protected]>
On Wed, Nov 29, 2006 at 09:58:43PM +0100, Antonio wrote:
> Hi all,
> 
> Would it be possible to interrupt a running Interpreter once I'm 
> evaluating an expression? If so, how can I do that in a safe way?

Yes.  
> 
> ( I was thinking of intepreter.tctx.nativeThread().interrupt() but I 
> don't know if this is safe/appropriate or not )

You need to do that *and* set the interrupt boolean in ThreadContext to 
true for the thread you wish to interrupt.
 
You can do this from Scheme code using thread/interrupt from the 
threading code as well.

> The fact is that I'm embedding SISC in an IDE, and I'd like all Scheme 
> evaluations to be cancellable. Interrupting the thread that runs the 
> Interpreter does not seem to work (because as far as I've seen SISC runs 
> its own threads?).
> 
Its not that it has its own threads, but rather that Java's interrupt 
only really affects a handful of methods which block.  It doesn't 
actually interrupt most threads.

	Scott


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV