[Mono-devel-list] Embedding Mono in a Virtual World

Paolo Molaro lupus at ximian.com
Wed Jan 26 13:23:09 EST 2005

On 01/26/05 Jim Purbrick wrote:
> > You can run the scripts in a thread and abort or
> > interrupt the thread after a timeout, but that won't
> > save the state of the script if you meant to reload
> > it later and restart it from where it was
> > interrupted.
> I need to restart the scripts transparently, as if
> they were running in a thread or fiber. Currently each
> running script has a stack, heap and registers which
> are saved when another script is scheduled.

I think you have two options:
*) inject code into the scripts to make them state machines
that will periodically check the timeout info and save the state to 
an object and reload it when it's restarted, similar to how the C#
compiler handles the yield construct.
*) use the threadpool as initially suggested: you will queue all
the scripts for execution. If a scripts takes lots of time to run,
the other scripts will be queued to other threads: since this should
happen rarely it should not be a problem, unless you also need
to guarantee against denial of service attempts. Note that this
means that the scripts will run concurrently.


lupus at debian.org                                     debian/rules
lupus at ximian.com                             Monkeys do it better

More information about the Mono-devel-list mailing list