There is currently no support for execution interruption in DLR or IronRuby. It is not sufficient to insert termination checks in DLR interpreter. You need to add checks on other places too. And it's better not to do it in the interpreter because interpreted code gets compiled after a while (or even immediately if it contains loops) and then your checks are gone. It is also not sufficient to look for loops in DLR trees produced by IronRuby (e.g. "loop" method performs the looping inside C# code).
The easiest way how to make this work is to place check into - WhileLoopExpression.cs: inside the infinite loop (AstFactory.Infinite...) - this ensures that all while loops in Ruby code are can be interrupted. - BlockDefinition.cs: right after Ast.Label(redoLabel). This makes any block-based loops interruptible. This should allow you to interrupt any Ruby loop. Note that interrupting Ruby code can corrupt the state of the VM (ScriptRuntime) so you should probably not reuse that Runtime for other executions. Tomas -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Aaron Clauson Sent: Thursday, July 09, 2009 4:44 PM To: [email protected] Subject: Re: [Ironruby-core] Interrupt Execution After spending a few hours delving into the DLR source I suspect the "interrupt execution" implementation is more related to the DLR core than IronRuby so I've posted a question over there http://dlr.codeplex.com/Thread/View.aspx?ThreadId=62052. Regards, Aaron -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list [email protected] http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list [email protected] http://rubyforge.org/mailman/listinfo/ironruby-core
