I have an application that executes user generated IronRuby scripts where each thread executes on its own thread. The issue I have is that certain events can occur that require the IronRuby script to be stopped at an arbitrary point in the script.
I can do it by aborting the thread the script is running on but that approach has introduced a memory leak into the application. After many months of investigation I have not been able to rectify except by scheduling automatic restarts of the application process. Consequently I am keen to move away from the use of Thread.Abort.
Is there any way to halt an IronRuby script from outside of the script?
The only other idea I can think of is to split each user's script into separate lines and insert a new line after the each script line that checks whether the script should halt but that is bound to introduce syntax errors.