huangyi wrote:
My project need to run and schedule many scripts written by user (and user can write code like "while(true) ;"), because the number of scripts is huge, so i use a single thread running all the scripts.so i need a function just like Abort() to interrupt the current script (if time out) and go on to run next script, but i don't know how to implement that in c/c++.

I'll warn you about something: The ThreadAbortException wasn't designed to be caught and ignored. According to specs, it will be thrown again at the end of any catch block that catches it. To cancel the thread abort, you would have to call the Thread.ResetAbort() method inside whatever catch block you use.

But therein lies another problem. If the user's scripting language supports it, the user can set up his own ThreadAbortException handler and either call Thread.Abort() or refuse to leave the catch block.

The .NET Framework 2.0 includes explicit support for what's called a "rude thread abort" which kills a thread and only guarantees that certain special finally blocks will be run, and no others. Does Mono have something similar?

I've considered this problem for running user scripts and concluded that whatever scripting language the user uses must allow me to define what a user can do, including setting up exception handlers and defining what external code is available (to limit access to Thread.ResetAbort()). I know there are scripting engines out there like that, but none comes to mind.

Does anyone have any recommendations?

--Brian
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to